home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / PDCUR24B.ZIP / include / curses.h next >
Encoding:
C/C++ Source or Header  |  2000-01-18  |  81.9 KB  |  2,112 lines

  1. /*
  2. ***************************************************************************
  3. * This file comprises part of PDCurses. PDCurses is Public Domain software.
  4. * You may use this code for whatever purposes you desire. This software
  5. * is provided AS IS with NO WARRANTY whatsoever.
  6. * Should this software be used in another application, an acknowledgement
  7. * that PDCurses code is used would be appreciated, but is not mandatory.
  8. *
  9. * Any changes which you make to this software which may improve or enhance
  10. * it, should be forwarded to the current maintainer for the benefit of 
  11. * other users.
  12. *
  13. * The only restriction placed on this code is that no distribution of
  14. * modified PDCurses code be made under the PDCurses name, by anyone
  15. * other than the current maintainer.
  16. * See the file maintain.er for details of the current maintainer.
  17. ***************************************************************************
  18. */
  19. /* 
  20. $Id$
  21. */
  22. /*
  23. *----------------------------------------------------------------------
  24. *                PDCurses
  25. *----------------------------------------------------------------------
  26. * MH
  27. *    991212    2.4
  28. *        Key modifiers pressed by themselves are now returned as keys
  29. *            KEY_SHIFT_L KEY_SHIFT_R 
  30. *            KEY_CONTROL_L KEY_CONTROL_R
  31. *            KEY_ALT_L KEY_ALT_R
  32. *            This works on Win32 and X11 ports only
  33. *        Added support for lcc-win32, supplied by Matthias Burian
  34. *        Added support for MingW32, and CygnusW32 compilers
  35. *        Added clipboard support for X11, Win32 and OS/2 ports
  36. *        Added ability to get to the input file descriptor
  37. *        New function for X11; Xinitscr() which allows standard X11
  38. *            switches to be passed to the application
  39. *        Added X11 shared library support
  40. *
  41. * MH
  42. *    960920    2.3    Added more System V R4 functions
  43. *
  44. *            Rewrote X11 port
  45. *
  46. *            Added Win32 port - original port by Chris Szurgot
  47. *                some updates by Mark Hessling
  48. *                some updates by Gurusamy Sarathy
  49. *
  50. *            slk() functions added by Kim Huron
  51. *
  52. *            Support for more and newer versions of compilers
  53. *
  54. *            Added mouse support for X11 and Win32 ports
  55. *
  56. *            Size of chtype now long
  57. *
  58. * MH
  59. *    950126    2.2    Added more System V R4 functions
  60. *
  61. *            Added beta Xwindows port
  62. *
  63. *            Changed chtype to long
  64. *
  65. *            Incorporated panels library
  66. *
  67. *            Support for more and newer versions of compilers
  68. *
  69. * MH
  70. *    930531    2.1    Added support for djgpp
  71. *
  72. *            Added beta Unix version
  73. *
  74. *            Added OS/2 DLL support.
  75. *
  76. *            Changed behaviour of overlay(), overwrite() and typeahead()
  77. *
  78. *    921120    2.0    Changed #if to #ifdef/#if defined to make it
  79. *            easier to add new platforms/compilers.
  80. *
  81. *            Added System V colour support.
  82. *
  83. *            Added OS/2 port.
  84. *-------
  85. * Frotz
  86. *    911221    2.0 pre-beta    Changed back from short to int. (int is the
  87. *            correct size for the default platform.  Short
  88. *            might be too short on some platforms.  This
  89. *            is more portable.  I, also, made this mistake.)
  90. *
  91. *            Many functions are now macros.  If you want
  92. *            the real thing, #undef the macro. (X/Open
  93. *            requirement.)
  94. *
  95. *            Merged many sources into current release.
  96. *
  97. *            Added many X/Open routines (not quite all yet).
  98. *
  99. *            Added internal documentation to all routines.
  100. *
  101. *            Added a HISTORY file to the environment.
  102. *
  103. *            Added a CONTRIB file to the environment.
  104. *-------
  105. * bl    900114    1.4    Window origin mod in overlay() and overwrite(), on
  106. *            public (and very reasonable) request. Swapped
  107. *            #define'd values of OK and ERR; OK now 1, and
  108. *            ERR is 0/NULL. Conforms better to UNIX
  109. *            versions.  borderchars[] removed from WINDOW
  110. *            struct since the border() functions were
  111. *            redefined. Use of short wherever possible.
  112. *            Portability improvements, mispelled name of
  113. *            [w]setscrreg().
  114. *
  115. *    881005    1.3    All modules lint-checked with MSC '-W3' and
  116. *            turbo'C' '-w -w-pro' switches. Support for
  117. *            border(), wborder() functions.
  118. *
  119. *    881002    1.2    Rcsid[] string in all modules, for maintenance.
  120. *
  121. *    880306    1.1    'Raw' output routines, revision info in curses.h.
  122. *
  123. *    870515    1.0    Initial Release.
  124. *
  125. *----------------------------------------------------------------------
  126. */
  127. #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS)
  128.  extern "C" 
  129.    {
  130. # define bool _bool
  131. #endif
  132.  
  133. #ifndef  __PDCURSES__
  134. #define    __PDCURSES__ 1
  135.  
  136. /*man-start*********************************************************************
  137.  
  138. All defines are "defined" here.  All compiler and environment
  139. specific definitions are defined into generic class defines.
  140. These defines are to be given values so that the code can
  141. rely on #if, rather than a complicated set of #if defined() or
  142. #ifdefs...
  143.  
  144. PDCurses definitions list:  (Only define those needed)
  145.  
  146.     REGISTERWINDOWS True for auto window update registery.
  147.     FAST_VIDEO      True if display is memory mapped, or
  148.                     we can utilize the fast video update routines.
  149.     DOS             True if compiling for DOS.
  150.     OS2             True if compiling for OS/2.
  151.     WIN32           True if compiling for Windoze 95 or Windoze NT
  152.     FLEXOS          True if compiling for Flexos.
  153.     HC              True if using a Metaware compiler.
  154.     TC              True if using a Borland compiler.
  155.     MSC             True if using a Microsoft compiler.
  156.     HAVE_PROTO      True if the compiler supports ANSI prototypes.
  157.     CPLUSPLUS       True if the compiler supports C++.
  158.     PDC_BUILD????   Defines API build version.
  159.  
  160. PDCurses portable platform definitions list:
  161.  
  162.     PDCURSES        Enables access to PDCurses-only routines.
  163.     XOPEN           Always true.
  164.     SYSVcurses      True if you are compiling for SYSV portability.
  165.     BSDcurses       True if you are compiling for BSD portability.
  166.     PDCURSES_WCLR   Makes behaviour of wclrtoeol() and wclrtoeof()
  167.                     unique to PDCurses. By default Unix behavior is set.
  168.                     See notes in wclrtoeol() and wclrtoeof().
  169. **man-end**********************************************************************/
  170.  
  171. #define PDC_BUILD    2401
  172. #define    PDCURSES    1    /* PDCurses-only routines    */
  173. #define    XOPEN        1    /* X/Open Curses routines    */
  174. #define    SYSVcurses    1    /* System V Curses routines    */
  175. #define    BSDcurses    1    /* BSD Curses routines        */
  176. #define    CHTYPE_LONG    1    /* size of chtype; long        */
  177.  
  178. #define    PDC_CDECL        /* default define this as empty */
  179.  
  180. /*----------------------------------------
  181. *       BORLAND COMPILERS       Turbo C[++], Borland C[++]
  182. *
  183. *       Borland definitions:
  184. *               TC
  185. *               DOS
  186. *               OS2
  187. *               CPLUSPLUS
  188. *
  189. *               __TURBOC__, __MSDOS__, 
  190. *               __OS2__ and __WIN32__
  191. *               are predefined by compiler.
  192. */
  193. #ifdef __TURBOC__              /* Borland gives defines this as a value*/
  194. #  define TC    __TURBOC__     /* Define a value for TC                */
  195. #  ifndef HAVE_PROTO
  196. #    define HAVE_PROTO 1       /* Borland supports ANSI C prototypes   */
  197. #  endif
  198. #  ifdef __MSDOS__
  199. #    define DOS 6              /* Major release of DOS supported       */
  200. #    include <bios.h>
  201. #    include <dos.h>
  202. #  endif
  203. #  ifdef __OS2__
  204. #    define OS2 3              /* Major release of OS/2 supported      */
  205. #    define INCL_VIO
  206. #    define INCL_KBD
  207. #    include <os2.h>
  208. #  endif
  209. #  ifdef __WIN32__
  210. #    ifdef INCLUDE_WINDOWS_H           /* only include for WIN32 files */
  211. #      include <windows.h>
  212. #      ifdef MOUSE_MOVED                 /* get rid of Windows #define */
  213. #        undef MOUSE_MOVED
  214. #      endif
  215. #    endif
  216. #    ifndef WIN32
  217. #      define WIN32 1
  218. #    endif
  219. #  endif
  220. #  if __TURBOC__ >= 0x290
  221. #    ifdef  __BCPLUSPLUS__
  222. #      define CPLUSPLUS   1    /* Define that we are compiling C++.    */
  223. #    endif
  224. #    ifdef  __TCPLUSPLUS__
  225. #      define CPLUSPLUS   1    /* Define that we are compiling C++.    */
  226. #    endif
  227. #    ifdef  __CPLUSPLUS__
  228. #      define CPLUSPLUS   1    /* Define that we are compiling C++.    */
  229. #    endif
  230. #  endif
  231. #  ifndef HAVE_LIMITS_H
  232. #    define HAVE_LIMITS_H                           /* have <limits.h> */
  233. #  endif
  234. #  ifndef HAVE_MEMORY_H
  235. #    define HAVE_MEMORY_H                           /* have <memory.h> */
  236. #  endif
  237. #  ifndef HAVE_STDARG_H
  238. #    define HAVE_STDARG_H                           /* have <stdarg.h> */
  239. #  endif
  240. #  ifndef HAVE_MEMMOVE
  241. #    define HAVE_MEMMOVE                             /* have memmove() */
  242. #  endif
  243. #  ifndef HAVE_VSSCANF
  244. #    define HAVE_VSSCANF                             /* have vsscanf() */
  245. #  endif
  246. #endif
  247.  
  248.  
  249. /*----------------------------------------
  250. *       METAWARE COMPILERS      High C
  251. *
  252. *       Metaware definitions:
  253. *               HC
  254. *               DOS
  255. *               FLEXOS
  256. */
  257. #ifdef __HIGHC__
  258. #  define HC    1
  259. #  pragma off(prototype_override_warnings)
  260. #  ifndef HAVE_PROTO
  261. #    define HAVE_PROTO 1      /* Metaware supports ANSI C prototypes   */
  262. #  endif
  263. #  ifdef __MSDOS__
  264. #    define DOS 6              /* Major release of DOS supported       */
  265. #    include <bios.h>
  266. #    include <dos.h>
  267. #  endif
  268. #  ifdef __FLEXOS__            /* define this on the command line      */
  269. #    define FLEXOS 2           /* or latest major release value.       */
  270. #  endif
  271. #endif
  272.  
  273. /*----------------------------------------
  274. *       MICROSOFT COMPILERS      MSC
  275. *
  276. *       Microsoft definitions:
  277. *               MSC
  278. *               DOS || OS2
  279. */
  280. #ifdef _MSC_VER                                 /* defined by compiler */
  281. #  define MSC   1
  282. #  ifndef HAVE_PROTO
  283. #    define HAVE_PROTO 1     /* Microsoft supports ANSI C prototypes   */
  284. #  endif
  285. #  ifdef __OS2__                /* You will have to define in makefile */
  286. #    define USE_OS2_H 1             /* Use the os2.h for the compiler  */
  287. #    define OS2 3                   /* Major release of OS/2 supported */
  288. #    define INCL_VIO
  289. #    define INCL_KBD
  290. #    include <os2.h>
  291. #    define FARKeyword far
  292. #    define APIRET USHORT
  293. #  else                            /* no __OS2__ define, so assume DOS */
  294. #    ifdef _WIN32    
  295. #      ifndef WIN32
  296. #        define WIN32 
  297. #      endif
  298. #      ifdef INCLUDE_WINDOWS_H         /* only include for WIN32 files */
  299. #        include <windows.h>
  300. #        ifdef MOUSE_MOVED               /* get rid of Windows #define */
  301. #          undef MOUSE_MOVED
  302. #        endif
  303. #      endif
  304. #      ifndef HAVE_MEMORY_H
  305. #        define HAVE_MEMORY_H                       /* have <memory.h> */
  306. #      endif
  307. #      ifndef HAVE_STDARG_H
  308. #        define HAVE_STDARG_H                       /* have <stdarg.h> */
  309. #      endif
  310. #    else    
  311. #      define DOS 6                  /* Major release of DOS supported */
  312. #      include <bios.h>
  313. #      include <dos.h>
  314. #      undef  HAVE_VSSCANF        /* vsscanf() function NOT in library */
  315. #    endif
  316. #  endif
  317. #  ifndef HAVE_LIMITS_H
  318. #    define HAVE_LIMITS_H                           /* have <limits.h> */
  319. #  endif
  320. #  ifndef HAVE_MEMMOVE
  321. #    define HAVE_MEMMOVE                             /* have memmove() */
  322. #  endif
  323. #endif
  324.  
  325. /*----------------------------------------
  326. *       MICROSOFT QUICK C COMPILERS      QC
  327. *
  328. */
  329. #ifdef _QC                                      /* defined by compiler */
  330. #  define MSC   1
  331. #  ifndef HAVE_PROTO
  332. #    define HAVE_PROTO 1        /* QuickC supports ANSI C prototypes   */
  333. #  endif
  334. #  define DOS 6                      /* Major release of DOS supported */
  335. #  include <bios.h>
  336. #  include <dos.h>
  337. #  undef  HAVE_VSSCANF            /* vsscanf() function NOT in library */
  338. #  ifndef HAVE_LIMITS_H
  339. #    define HAVE_LIMITS_H                           /* have <limits.h> */
  340. #  endif
  341. #endif
  342.  
  343. /*----------------------------------------
  344. *       TOPSPEED compilers     TSC
  345. *
  346. *       TOPSPEED definitions:
  347. *               TSC
  348. *               DOS || OS2
  349. */
  350. #ifdef __TSC__                   /* You may have to define in makefile */
  351. #  define TSC   1
  352. #  ifndef HAVE_PROTO
  353. #    define HAVE_PROTO 1      /* TopSpeed supports ANSI C prototypes   */
  354. #  endif
  355. #  ifdef __OS2__
  356. #    define OS2 3                   /* Major release of OS/2 supported */
  357. #    define INCL_VIO
  358. #    define INCL_KBD
  359. #    include <os2.h>
  360. #  endif
  361. #  ifndef HAVE_LIMITS_H
  362. #    define HAVE_LIMITS_H                           /* have <limits.h> */
  363. #  endif
  364. #endif
  365.  
  366. /*----------------------------------------
  367. *       IBM C Set/2 Compiler   CSET2
  368. *
  369. *       IBM definitions:
  370. *               CSET2
  371. *               OS2
  372. */
  373. #ifdef __IBMC__
  374. #  define CSET2 1
  375. #  ifndef HAVE_PROTO
  376. #    define HAVE_PROTO 1        /* C Set/2 supports ANSI C prototypes  */
  377. #  endif
  378. #  ifndef HAVE_STDARG_H
  379. #    define HAVE_STDARG_H                           /* have <stdarg.h> */
  380. #  endif
  381. #  ifndef HAVE_LIMITS_H
  382. #    define HAVE_LIMITS_H                           /* have <limits.h> */
  383. #  endif
  384. #  ifndef HAVE_MEMORY_H
  385. #    define HAVE_MEMORY_H                           /* have <memory.h> */
  386. #  endif
  387. #  ifndef HAVE_MEMMOVE
  388. #    define HAVE_MEMMOVE                             /* have memmove() */
  389. #  endif
  390. #  ifdef __OS2__
  391. #    define OS2 3                   /* Major release of OS/2 supported */
  392. #    define INCL_VIO
  393. #    define INCL_KBD
  394. #    include <os2.h>
  395. #  endif
  396. #endif
  397.  
  398. /*----------------------------------------
  399. *       GNU compilers     emx
  400. *
  401. *       emx definitions:
  402. *               EMX
  403. *               OS2
  404. */
  405. #ifdef __EMX__                   /* You may have to define in makefile */
  406. #  define EMX   1
  407. #  ifndef HAVE_PROTO
  408. #    define HAVE_PROTO 1            /* emx supports ANSI C prototypes  */
  409. #  endif
  410. #  define __OS2__                      /* EMX does not define this :-( */
  411. #  define OS2 3                     /* Major release of OS/2 supported */
  412. #  define CURSES__32BIT__
  413. #  ifndef HAVE_STDARG_H
  414. #    define HAVE_STDARG_H                           /* have <stdarg.h> */
  415. #  endif
  416. #  ifndef HAVE_LIMITS_H
  417. #    define HAVE_LIMITS_H                           /* have <limits.h> */
  418. #  endif
  419. #  ifndef HAVE_MEMORY_H
  420. #    define HAVE_MEMORY_H                           /* have <memory.h> */
  421. #  endif
  422. #  ifndef HAVE_UNISTD_H
  423. #    define HAVE_UNISTD_H                           /* have <unistd.h> */
  424. #  endif
  425. #  ifndef HAVE_MEMMOVE
  426. #    define HAVE_MEMMOVE                             /* have memmove() */
  427. #  endif
  428. #  ifndef HAVE_VSSCANF
  429. #    define HAVE_VSSCANF                             /* have vsscanf() */
  430. #  endif
  431. #  if defined(EMXVIDEO)
  432. #    include <stdlib.h>
  433. #    include <sys/video.h>
  434. #  else
  435. #    define INCL_VIO
  436. #    define INCL_KBD
  437. #    include <os2.h>
  438. #  endif
  439. #endif
  440.  
  441. /*----------------------------------------
  442. *       GNU compilers     djgpp
  443. *
  444. *        djgpp definitions:
  445. *                GO32
  446. *                DOS
  447. */
  448. #ifdef GO32                   /* You may have to define in makefile */
  449. #  ifndef HAVE_PROTO
  450. #    define HAVE_PROTO 1         /* DJGPP supports ANSI C prototypes   */
  451. #  endif
  452. #  define DOS    6
  453. #  include <dos.h>
  454. #  ifdef __FLEXOS__            /* define this on the command line       */
  455. #    define FLEXOS 2           /* or latest major release value.       */
  456. #  endif
  457. #  define CURSES__32BIT__
  458. #  ifdef _cplusplus
  459. #    define CPLUSPLUS 1
  460. #  endif
  461. #  ifndef HAVE_STDARG_H
  462. #    define HAVE_STDARG_H                           /* have <stdarg.h> */
  463. #  endif
  464. #  ifndef HAVE_LIMITS_H
  465. #    define HAVE_LIMITS_H                           /* have <limits.h> */
  466. #  endif
  467. #  ifndef HAVE_MEMORY_H
  468. #    define HAVE_MEMORY_H                           /* have <memory.h> */
  469. #  endif
  470. #  ifndef HAVE_UNISTD_H
  471. #    define HAVE_UNISTD_H                           /* have <unistd.h> */
  472. #  endif
  473. #  ifndef HAVE_MEMMOVE
  474. #    define HAVE_MEMMOVE                             /* have memmove() */
  475. #  endif
  476. #  ifndef HAVE_USLEEP
  477. #    define HAVE_USLEEP                               /* have usleep() */
  478. #  endif
  479. #endif
  480.  
  481.  
  482. /*----------------------------------------
  483. *       GNU compilers     Cygnus Win32
  484. *
  485. *        cygnus definitions:
  486. *                WIN32
  487. */
  488. #ifdef __CYGWIN32__  /* You may have to define in makefile */
  489. #  ifndef HAVE_PROTO
  490. #    define HAVE_PROTO 1    /* Cygnuc GCC supports ANSI C prototypes   */
  491. #  endif
  492. #  ifdef INCLUDE_WINDOWS_H
  493. #    include <windows.h>
  494. #    ifdef MOUSE_MOVED
  495. #      undef MOUSE_MOVED
  496. #    endif
  497. #  endif
  498. #  ifndef WIN32
  499. #    define WIN32
  500. #  endif
  501. #  ifndef INT_MAX
  502. #    define INT_MAX 32762
  503. #  endif
  504. #  define CURSES__32BIT__
  505. #  ifndef HAVE_LIMITS_H
  506. #    define HAVE_LIMITS_H                           /* have <limits.h> */
  507. #  endif
  508. #  ifndef HAVE_MEMORY_H
  509. #    define HAVE_MEMORY_H                           /* have <memory.h> */
  510. #  endif
  511. #  ifndef HAVE_STDARG_H
  512. #    define HAVE_STDARG_H                           /* have <stdarg.h> */
  513. #  endif
  514. #  ifndef HAVE_UNISTD_H
  515. #    define HAVE_UNISTD_H                           /* have <unistd.h> */
  516. #  endif
  517. #  ifndef HAVE_MEMMOVE
  518. #    define HAVE_MEMMOVE                             /* have memmove() */
  519. #  endif
  520. #  ifndef HAVE_USLEEP
  521. #    define HAVE_USLEEP                               /* have usleep() */
  522. #  endif
  523. #endif
  524.  
  525. /*----------------------------------------
  526. *       GNU compilers     Ming Win32
  527. *
  528. *        Ming definitions:
  529. *                WIN32
  530. */
  531. #ifdef __MINGW32__
  532. #  ifndef HAVE_PROTO
  533. #    define HAVE_PROTO 1    /* Ming GCC supports ANSI C prototypes   */
  534. #  endif
  535. #  ifdef INCLUDE_WINDOWS_H
  536. #    include <windows.h>
  537. #    ifdef MOUSE_MOVED
  538. #      undef MOUSE_MOVED
  539. #    endif
  540. #  endif
  541. #  ifndef WIN32
  542. #    define WIN32
  543. #  endif
  544. #  define CURSES__32BIT__
  545. #  ifndef HAVE_LIMITS_H
  546. #    define HAVE_LIMITS_H                           /* have <limits.h> */
  547. #  endif
  548. #  ifndef HAVE_MEMORY_H
  549. #    define HAVE_MEMORY_H                           /* have <memory.h> */
  550. #  endif
  551. #  ifndef HAVE_STDARG_H
  552. #    define HAVE_STDARG_H                           /* have <stdarg.h> */
  553. #  endif
  554. #  ifndef HAVE_UNISTD_H
  555. #    define HAVE_UNISTD_H                           /* have <unistd.h> */
  556. #  endif
  557. #  ifndef HAVE_MEMMOVE
  558. #    define HAVE_MEMMOVE                             /* have memmove() */
  559. #  endif
  560. #endif
  561.  
  562. /*----------------------------------------
  563. *       LCC WIN32
  564. *
  565. */
  566. #ifdef __LCC__  /* should already be defined by the compiler */
  567. #  ifndef HAVE_PROTO
  568. #    define HAVE_PROTO 1         /* LCC-Win32 supports ANSI C prototypes   */
  569. #  endif
  570. #  ifdef INCLUDE_WINDOWS_H
  571. #    include <windows.h>
  572. #    ifdef MOUSE_MOVED
  573. #      undef MOUSE_MOVED
  574. #    endif
  575. #  endif
  576. #  ifndef WIN32
  577. #    define WIN32
  578. #  endif
  579. #  ifndef INT_MAX
  580. #    define INT_MAX 32762
  581. #  endif
  582. #  ifndef HAVE_LIMITS_H
  583. #    define HAVE_LIMITS_H                           /* have <limits.h> */
  584. #  endif
  585. #  ifndef HAVE_MEMORY_H
  586. #    define HAVE_MEMORY_H                           /* have <memory.h> */
  587. #  endif
  588. #  ifndef HAVE_STDARG_H
  589. #    define HAVE_STDARG_H                           /* have <stdarg.h> */
  590. #  endif
  591. #  ifndef HAVE_MEMMOVE
  592. #    define HAVE_MEMMOVE                             /* have memmove() */
  593. #  endif
  594. #endif
  595.  
  596. /*----------------------------------------
  597. *       Watcom C/C++ 10.6 compiler
  598. *
  599. *       WATCOM definitions:
  600. *               WATCOMC
  601. *               OS2
  602. *               WIN32
  603. */
  604. #ifdef __WATCOMC__
  605. #  define WATCOMC  1
  606. #  ifndef HAVE_PROTO
  607. #    define HAVE_PROTO 1      /* Watcom C supports ANSI C prototypes   */
  608. #  endif
  609. #  define CURSES__32BIT__
  610. #  if defined( __DOS__ ) || defined( __DOS4G__ )
  611. #    define DOS 7                    /* Major release of DOS supported */
  612. #    include <bios.h>
  613. #    include <dos.h>
  614. #    include <i86.h>
  615. #    ifdef __386__
  616. #      define int86 int386
  617. #      define int86x int386x
  618. #    endif
  619. #  endif
  620. #  if defined( __OS2__ ) || defined( __OS2V2__ )
  621. #    define OS2 3                   /* Major release of OS/2 supported */
  622. #    define CURSES__32BIT__
  623. #    define INCL_VIO
  624. #    define INCL_KBD
  625. #    include <os2.h>
  626. #  endif
  627. #  ifdef __NT__                         /* This specifies WIN32 target */
  628. #    ifdef INCLUDE_WINDOWS_H
  629. #      include <windows.h>
  630. #      ifdef MOUSE_MOVED
  631. #        undef MOUSE_MOVED
  632. #      endif
  633. #    endif
  634. #    ifndef WIN32
  635. #      define WIN32
  636. #    endif
  637.  
  638. /*
  639. #    ifdef PDC_CDECL
  640. #      undef PDC_CDECL
  641. #      define PDC_CDECL cdecl
  642. #    endif
  643. */
  644.  
  645. #  endif
  646. #  ifndef HAVE_LIMITS_H
  647. #    define HAVE_LIMITS_H                           /* have <limits.h> */
  648. #  endif
  649. #  ifndef HAVE_MEMORY_H
  650. #    define HAVE_MEMORY_H                           /* have <memory.h> */
  651. #  endif
  652. #  ifndef HAVE_STDARG_H
  653. #    define HAVE_STDARG_H                           /* have <stdarg.h> */
  654. #  endif
  655. #  ifndef HAVE_MEMMOVE
  656. #    define HAVE_MEMMOVE                             /* have memmove() */
  657. #  endif
  658. #  ifndef HAVE_VSSCANF
  659. #    define HAVE_VSSCANF                             /* have vsscanf() */
  660. #  endif
  661. #endif
  662.  
  663. #if 0
  664. /*----------------------------------------
  665. *       gcc under UNIX
  666. *
  667. *       GNU definitions:
  668. *               UNIX
  669. */
  670. #ifdef UNIX
  671. #  define HAVE_PROTO 1                  /* GNU C supports ANSI C prototypes  */
  672. #  ifdef SUNOS
  673. #    define NO_VSSCANF
  674. #    define NO_MEMMOVE
  675. #    undef BSD
  676. #  endif
  677. #  ifdef linux
  678. #    undef BSD
  679. #  endif
  680. #endif
  681. #endif
  682.  
  683. /*----------------------------------------
  684. *       MicroWay NDP C/C++ 386 4.2.0 compiler
  685. */
  686. #ifdef MX386
  687. #  define HAVE_PROTO 1
  688. #  define NDP    1
  689. #  include     <bios.h>
  690. #  ifdef DOS
  691. #    define MK_FP(seg,ofs)    ( (((int) (seg)) << 4) + ((int) (ofs)) )
  692. #    ifdef __i860
  693.        typedef void _int;
  694. #    else
  695.        typedef int      _int;
  696. #    endif
  697. #  endif
  698. #    undef  NO_VSSCANF            /* vsscanf() function NOT in library */
  699. #  ifndef HAVE_LIMITS_H
  700. #    define HAVE_LIMITS_H                           /* have <limits.h> */
  701. #  endif
  702. #endif
  703.  
  704. /*---------------------------------------------------------------------*/
  705. #include <stdio.h>        /* Required by X/Open usage below    */
  706. /*----------------------------------------------------------------------
  707.  *
  708.  *    PDCurses Manifest Constants
  709.  *
  710.  */
  711. #ifndef FALSE            /* booleans         */
  712. #  define    FALSE    0
  713. #endif
  714. #ifndef    TRUE            /* booleans         */
  715. #  define    TRUE    !FALSE
  716. #endif
  717. #ifndef    NULL
  718. #  define NULL    0    /* Null pointer         */
  719. #endif
  720. #ifndef    ERR
  721. #  define     ERR    0        /* general error flag     */
  722. #endif
  723. #ifndef    OK
  724. #  define     OK    1        /* general OK flag     */
  725. #endif
  726.  
  727.  
  728. /*----------------------------------------------------------------------
  729.  *
  730.  *    PDCurses Type Declarations
  731.  *
  732.  */
  733. typedef unsigned char bool;    /* PDCurses Boolean type    */
  734.  
  735. #ifdef CHTYPE_LONG
  736. typedef unsigned long chtype;    /* 16-bit attr + 16-bit char    */
  737. #else
  738. typedef unsigned short chtype;    /* 8-bit attr + 8-bit char    */
  739. #endif
  740.  
  741. /*----------------------------------------------------------------------
  742.  * This defines a new type for attributes.
  743.  *
  744.  */
  745. typedef chtype attr_t;
  746.  
  747. /*----------------------------------------------------------------------
  748.  * Define our mouse interface - same as SYSVR4 (with extensions)
  749.  */
  750.  
  751. typedef struct
  752. {
  753.     int x;           /* absolute column, 0 based, measured in characters */
  754.     int y;           /* absolute row, 0 based, measured in characters */
  755.     short button[3]; /* state of each button */
  756.     int changes;     /* flags indicating what has changed with the mouse */
  757. } MOUSE_STATUS;
  758.  
  759.  
  760. #define BUTTON_RELEASED        0000
  761. #define BUTTON_PRESSED         0001
  762. #define BUTTON_CLICKED         0002
  763. #define BUTTON_DOUBLE_CLICKED  0003
  764. #define BUTTON_TRIPLE_CLICKED  0004
  765. #define BUTTON_MOVED           0005  /* PDCurses enhancement */
  766. #define BUTTON_ACTION_MASK     0007  /* PDCurses enhancement */
  767. #define BUTTON_SHIFT           0010  /* PDCurses enhancement */
  768. #define BUTTON_CONTROL         0020  /* PDCurses enhancement */
  769. #define BUTTON_ALT             0040  /* PDCurses enhancement */
  770. #define BUTTON_MODIFIER_MASK   0070  /* PDCurses enhancement */
  771.  
  772. #define MOUSE_X_POS            (Mouse_status.x)
  773. #define MOUSE_Y_POS            (Mouse_status.y)
  774. #define A_BUTTON_CHANGED       (Mouse_status.changes & 7)
  775. #define MOUSE_MOVED            (Mouse_status.changes & 8)
  776. #define MOUSE_POS_REPORT       (Mouse_status.changes & 16)
  777. #define BUTTON_CHANGED(x)      (Mouse_status.changes & (1 << ((x) - 1)))
  778. #define BUTTON_STATUS(x)       (Mouse_status.button[(x)-1])
  779.  
  780. /* mouse bit-masks */
  781. #define BUTTON1_RELEASED        000000000001L
  782. #define BUTTON1_PRESSED         000000000002L
  783. #define BUTTON1_CLICKED         000000000004L
  784. #define BUTTON1_DOUBLE_CLICKED  000000000010L
  785. #define BUTTON1_TRIPLE_CLICKED  000000000020L
  786. #define BUTTON1_MOVED           000000000020L /* PDCurses enhancement */
  787. #define BUTTON2_RELEASED        000000000040L
  788. #define BUTTON2_PRESSED         000000000100L
  789. #define BUTTON2_CLICKED         000000000200L
  790. #define BUTTON2_DOUBLE_CLICKED  000000000400L
  791. #define BUTTON2_TRIPLE_CLICKED  000000001000L
  792. #define BUTTON2_MOVED           000000001000L /* PDCurses enhancement */
  793. #define BUTTON3_RELEASED        000000002000L
  794. #define BUTTON3_PRESSED         000000004000L
  795. #define BUTTON3_CLICKED         000000010000L
  796. #define BUTTON3_DOUBLE_CLICKED  000000020000L
  797. #define BUTTON3_TRIPLE_CLICKED  000000040000L
  798. #define BUTTON3_MOVED           000000040000L /* PDCurses enhancement */
  799. #define BUTTON_MODIFIER_SHIFT   000000100000L /* PDCurses enhancement */
  800. #define BUTTON_MODIFIER_CONTROL 000000200000L /* PDCurses enhancement */
  801. #define BUTTON_MODIFIER_ALT     000000400000L /* PDCurses enhancement */
  802. #define ALL_MOUSE_EVENTS        000000777777L
  803. #define REPORT_MOUSE_POSITION   000001000000L
  804.  
  805. /*----------------------------------------------------------------------
  806.  *
  807.  *    PDCurses Structure Definitions:
  808.  *
  809.  */
  810. typedef struct _win        /* definition of a window.       */
  811. {
  812.     int    _cury;        /* current pseudo-cursor       */
  813.     int    _curx;
  814.     int    _maxy;        /* max window coordinates       */
  815.     int    _maxx;
  816.     int    _pmaxy;        /* max physical size           */
  817.     int    _pmaxx;
  818.     int    _begy;        /* origin on screen           */
  819.     int    _begx;
  820.     int    _lastpy;    /* last y coordinate of upper left pad display area */
  821.     int    _lastpx;    /* last x coordinate of upper left pad display area */
  822.     int    _lastsy1;    /* last upper y coordinate of screen window for pad */
  823.     int    _lastsx1;    /* last upper x coordinate of screen window for pad */
  824.     int    _lastsy2;    /* last lower y coordinate of screen window for pad */
  825.     int    _lastsx2;    /* last lower x coordinate of screen window for pad */
  826.     int    _flags;        /* window properties           */
  827.     attr_t    _attrs;        /* standard A_STANDOUT attributes and colors  */
  828.     chtype    _bkgd;        /* wrs(4/6/93) background, normally blank */
  829.     int    _tabsize;    /* tab character size           */
  830.     bool    _clear;        /* causes clear at next refresh       */
  831.     bool    _leaveit;        /* leaves cursor where it is       */
  832.     bool    _scroll;    /* allows window scrolling       */
  833.     bool    _nodelay;    /* input character wait flag       */
  834.     bool    _immed;    /* immediate update flag       */
  835.     bool    _sync;    /* synchronise window ancestors       */
  836.     bool    _use_keypad;    /* flags keypad key mode active       */
  837.     bool    _use_idl;    /* True if Ins/Del line can be used*/
  838.     bool    _use_idc;    /* True if Ins/Del character can be used*/
  839.     chtype**_y;        /* pointer to line pointer array   */
  840.     int*    _firstch;    /* first changed character in line */
  841.     int*    _lastch;    /* last changed character in line  */
  842.     int    _tmarg;    /* top of scrolling region       */
  843.     int    _bmarg;    /* bottom of scrolling region       */
  844.     char*    _title;        /* window title               */
  845.     char    _title_ofs;    /* window title offset from left   */
  846.     attr_t    _title_attr;    /* window title attributes       */
  847.     chtype    _blank;        /* window's blank character       */
  848.     int    _parx, _pary;    /* coords relative to parent (0,0) */
  849. struct    _win*    _parent;    /* subwin's pointer to parent win  */
  850. }    WINDOW;
  851.  
  852.  
  853.  
  854. /*----------------------------------------------------------------------
  855. *
  856. *    Private structures that are necessary for correct
  857. *    macro construction.
  858. *
  859. */
  860.  
  861. #ifdef    REGISTERWINDOWS
  862. typedef struct _ref        /* Refresh Window Structure     */
  863. {
  864.     WINDOW*    win;
  865. struct    _ref*    next;
  866. struct    _ref*    tail;
  867. }    ACTIVE;
  868.  
  869. typedef struct _wins
  870. {
  871.     WINDOW*        w;    /* pointer to a visible window        */
  872.     struct _wins*    next;    /* Next visible window pointer        */
  873.     struct _wins*    prev;    /* Next visible window pointer        */
  874.     struct _wins*    tail;    /* Last visible window pointer        */
  875.                 /* Only head window (stdscr) has    */
  876.                 /* a valid tail pointer.        */
  877. }    WINDS;
  878. #endif
  879.  
  880. typedef struct        /* structure for ripped off lines */
  881. {
  882.     int line;
  883.     int (*init)();
  884. } RIPPEDOFFLINE;
  885.  
  886.  
  887. typedef struct
  888. {
  889.     bool    alive;        /* if initscr() called            */
  890.     bool    autocr;        /* if lf -> crlf            */
  891.     bool    cbreak;        /* if terminal unbuffered        */
  892.     bool    echo;        /* if terminal echo            */
  893.     bool    raw_inp;    /* raw input mode (v. cooked input) */
  894.     bool    raw_out;    /* raw output mode (7 v. 8 bits)    */
  895.     bool    refrbrk;    /* if premature refresh brk allowed */
  896.     bool    orgcbr;        /* original MSDOS ^-BREAK setting   */
  897.     bool    visible_cursor; /* TRUE if cursor is visible        */
  898.     bool    audible;    /* FALSE if the bell is visual        */
  899.     bool    full_redraw;    /* TRUE for bad performance        */
  900.     bool    direct_video;    /* Allow Direct Screen Memory writes*/
  901.     bool    mono;        /* TRUE if current screen is mono.  */
  902.     bool    sizeable;    /* TRUE if adapter is resizeable.   */
  903.     bool    resized;    /* TRUE if TERM has been resized */
  904.     bool    bogus_adapter;    /* TRUE if adapter has insane values*/
  905.     bool    shell;        /* TRUE if reset_prog_mode() needs  */
  906.                 /*    to be called.            */
  907.     chtype    blank;        /* Background character            */
  908.     attr_t    orig_attr;    /* Original screen attributes        */
  909.     int    cursrow;    /* position of physical cursor        */
  910.     int    curscol;    /* position of physical cursor        */
  911.     int    cursor;        /* Current Cursor definition        */
  912.     int    visibility;        /* Visibility of cursor    */
  913.     int    video_page;    /* Current PC video page        */
  914.     int    orig_emulation; /* Original cursor emulation value  */
  915.     int    orig_cursor;    /* Original cursor size            */
  916.     int    font;        /* default font size            */
  917.     int    orig_font;    /* Original font size            */
  918.     int    lines;        /* New value for LINES            */
  919.     int    cols;        /* New value for COLS            */
  920.     unsigned long _trap_mbe;        /* trap these mouse button events */
  921.     unsigned long _map_mbe_to_key;    /* map mouse buttons to slk */
  922.     int    slklines;        /* Lines in use by slk_init() */
  923.     WINDOW *    slk_winptr;        /* window for slk */
  924.     int    linesrippedoff;        /* Lines ripped off via ripoffline() */
  925.     int    linesrippedoffontop;        /* Lines ripped off on top via ripoffline() */
  926.     int    delaytenths;        /* 1/10ths second to wait block getch() for */
  927.     bool    _preserve;        /* TRUE if screen background to be preserved */
  928.     bool    _restore;        /* TRUE if screen background to be restored */
  929.     bool    save_key_modifiers;        /* TRUE if each key modifiers saved with each key press */
  930.     bool    return_key_modifiers;        /* TRUE if modifier keys are returned as "real" keys */
  931.  
  932. #ifdef OS2
  933. # ifdef EMXVIDEO            /* nop if using EMX builtins */
  934.     int tahead;             /* Type-ahead value */
  935.     int adapter;            /* Screen type    */
  936. # else
  937.     VIOMODEINFO scrnmode;    /* default screen mode            */
  938.     VIOCONFIGINFO adapter;    /* Screen type                */
  939. # endif
  940. #else
  941.     int adapter;            /* Screen type    */
  942. #endif
  943.  
  944. #if defined(DOS) || defined(WIN32)
  945.     int    scrnmode;    /* default screen mode            */
  946.     unsigned video_seg;    /* video base segment            */
  947.     unsigned video_ofs;    /* video base offset            */
  948. #endif
  949.  
  950. #if defined(OS2) || defined(WIN32)
  951.     int    num_mouse_buttons;    /* number of mouse buttons */
  952. #endif
  953.  
  954. #if defined (XCURSES)
  955.     int    XcurscrSize; /* size of Xcurscr shared memory block */
  956.     bool    sb_on;
  957.     int    sb_viewport_y;
  958.     int    sb_viewport_x;
  959.     int    sb_total_y;
  960.     int    sb_total_x;
  961.     int    sb_cur_y;
  962.     int    sb_cur_x;
  963. #endif
  964.  
  965. #ifdef    REGISTERWINDOWS
  966.     WINDS*    visible;    /* List of visible windows        */
  967.     bool    refreshall;    /* Refresh all registered windows?  */
  968. #endif
  969.  
  970. }    SCREEN;
  971.  
  972.  
  973. /* external variables */
  974. #if !defined(PDC_STATIC_BUILD) && defined(_MSC_VER) && defined(WIN32) && !defined(CURSES_LIBRARY)
  975. __declspec(dllimport)    int    LINES;        /* terminal height        */
  976. __declspec(dllimport)    int    COLS;        /* terminal width        */
  977. __declspec(dllimport)    WINDOW*    stdscr;        /* the default screen window    */
  978. __declspec(dllimport)    WINDOW*    curscr;        /* the current screen image    */
  979. __declspec(dllimport)    SCREEN    *SP;    /* curses variables        */
  980. __declspec(dllimport)    int    use_emalloc;    /* set to true to use your own malloc,etc */
  981. __declspec(dllimport)    MOUSE_STATUS Mouse_status;
  982. __declspec(dllimport)    int COLORS;
  983. __declspec(dllimport)    int COLOR_PAIRS;
  984. #else
  985. # if !defined(PDC_STATIC_BUILD) && defined(_MSC_VER) && defined(WIN32)
  986. __declspec(dllexport) extern    int    LINES;        /* terminal height        */
  987. __declspec(dllexport) extern    int    COLS;        /* terminal width        */
  988. __declspec(dllexport) extern    WINDOW*    stdscr;        /* the default screen window    */
  989. __declspec(dllexport) extern    WINDOW*    curscr;        /* the current screen image    */
  990. __declspec(dllexport) extern    SCREEN    *SP;    /* curses variables        */
  991. __declspec(dllexport) extern    int    use_emalloc;    /* set to true to use your own malloc,etc */
  992. __declspec(dllexport) extern    MOUSE_STATUS Mouse_status;
  993. __declspec(dllexport) extern    int COLORS;
  994. __declspec(dllexport) extern    int COLOR_PAIRS;
  995. # else
  996. extern    int    LINES;        /* terminal height        */
  997. extern    int    COLS;        /* terminal width        */
  998. extern    WINDOW*    stdscr;        /* the default screen window    */
  999. extern    WINDOW*    curscr;        /* the current screen image    */
  1000. extern    SCREEN    *SP;    /* curses variables        */
  1001. extern    int    use_emalloc;    /* set to true to use your own malloc,etc */
  1002. extern    MOUSE_STATUS Mouse_status;
  1003. extern    int COLORS,COLOR_PAIRS;
  1004. # endif
  1005. #endif
  1006.  
  1007. #if    defined (CURSES_LIBRARY)
  1008. extern    int    _default_lines;    /* For presetting maximum lines    */
  1009. #endif
  1010.  
  1011. #ifdef    REGISTERWINDOWS
  1012. extern    ACTIVE*    CurWins;    /* Currently Visible Windows    */
  1013. #endif
  1014.  
  1015.  
  1016.  
  1017.  
  1018. /*man-start*********************************************************************
  1019.  
  1020. PDCurses Text Attributes:
  1021.  
  1022. To include colour in PDCurses, a number of things had to be sacrificed
  1023. from the strict Unix and System V support.
  1024. The main problem is fitting all character attributes and colour into
  1025. an unsigned char (all 8 bits!). On System V, chtype is a long on
  1026. PDCurses it is a short int.
  1027.  
  1028. The following is the structure of a win->_attrs chtype:
  1029.  
  1030. -------------------------------------------------------------------------------------------------
  1031. |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
  1032. -------------------------------------------------------------------------------------------------
  1033.      colour number      |     modifiers         |      character eg 'a' (potential for DBCS)
  1034.  
  1035. The available attribute modifiers are bold, underline, invisible, protect, reverse 
  1036. and blink.
  1037.  
  1038. **man-end**********************************************************************/
  1039.  
  1040. /* Video attribute definitions. */
  1041. #ifdef CHTYPE_LONG
  1042. #define A_NORMAL            0x00000000L
  1043. #define A_STANDOUT          0x00A00000L
  1044. #define A_BOLD              0x00800000L
  1045. #define A_UNDERLINE         0x00100000L
  1046. #define A_REVERSE           0x00200000L
  1047. #define A_BLINK             0x00400000L
  1048. #define A_DIM               0x00020000L
  1049. #define A_INVIS             0x00080000L
  1050. #define A_PROTECT           0x00010000L
  1051. #define A_ALTCHARSET        0x00040000L
  1052. #define A_ATTRIBUTES        0xFFFF0000L
  1053. #define A_CHARTEXT          0x0000FFFFL
  1054. #define A_COLOR             0xFF000000L
  1055.  
  1056. #else
  1057.  
  1058. #define A_NORMAL    (chtype)0x0000        /* SysV */
  1059. #define A_ALTCHARSET    (chtype)0x0000        /* X/Open    */
  1060. #define A_BLINK        (chtype)0x0400        /* X/Open    */
  1061. #define A_BLANK        (chtype)0x0000        /* X/Open    */
  1062. #define A_BOLD        (chtype)0x0100        /* X/Open    */
  1063. #define A_DIM        (chtype)0x0000        /* X/Open    */
  1064. #define A_PROTECT    (chtype)0x0000        /* X/Open    */
  1065. #define A_REVERSE    (chtype)0x0200        /* X/Open    */
  1066. #define A_STANDOUT    ((chtype)(A_REVERSE | A_BOLD))        /* X/Open    */
  1067. #define A_UNDERLINE    (chtype)0x0000        /* X/Open    */
  1068. #define A_COLOR    (chtype)0xF800        /*System V    */
  1069. #define A_CHARTEXT    (chtype)(0xFF)            /* X/Open    */
  1070. #define A_ATTRIBUTES    (chtype)(~A_CHARTEXT)            /* X/Open    */
  1071. #endif
  1072.  
  1073. #define CHR_MSK        A_CHARTEXT        /* Obsolete    */
  1074. #define ATR_MSK        A_ATTRIBUTES    /* Obsolete    */
  1075. #define ATR_NRM        A_NORMAL            /* Obsolete    */
  1076.  
  1077. #ifdef XCURSES
  1078. extern chtype *acs_map;
  1079.  
  1080. # define ACS_BSSB    (acs_map['l'])
  1081. # define ACS_SSBB    (acs_map['m'])
  1082. # define ACS_BBSS    (acs_map['k'])
  1083. # define ACS_SBBS    (acs_map['j'])
  1084. # define ACS_SBSS    (acs_map['u'])
  1085. # define ACS_SSSB    (acs_map['t'])
  1086. # define ACS_SSBS    (acs_map['v'])
  1087. # define ACS_BSSS    (acs_map['w'])
  1088. # define ACS_BSBS    (acs_map['q'])
  1089. # define ACS_SBSB    (acs_map['x'])
  1090. # define ACS_SSSS    (acs_map['n'])
  1091.  
  1092. # define ACS_ULCORNER    ACS_BSSB
  1093. # define ACS_LLCORNER    ACS_SSBB
  1094. # define ACS_URCORNER    ACS_BBSS
  1095. # define ACS_LRCORNER    ACS_SBBS
  1096. # define ACS_RTEE        ACS_SBSS
  1097. # define ACS_LTEE        ACS_SSSB
  1098. # define ACS_BTEE        ACS_SSBS
  1099. # define ACS_TTEE        ACS_BSSS
  1100. # define ACS_HLINE       ACS_BSBS
  1101. # define ACS_VLINE       ACS_SBSB
  1102. # define ACS_PLUS        ACS_SSSS
  1103.  
  1104. # define ACS_S1    (acs_map['o'])
  1105. # define ACS_S9    (acs_map['s'])
  1106. # define ACS_DIAMOND    (acs_map['\''])
  1107. # define ACS_CKBOARD    (acs_map['a'])
  1108. # define ACS_DEGREE    (acs_map['f'])
  1109. # define ACS_PLMINUS    (acs_map['g'])
  1110. # define ACS_BULLET    (acs_map['~'])
  1111. # define ACS_LARROW    (acs_map[','])
  1112. # define ACS_RARROW    (acs_map['+'])
  1113. # define ACS_DARROW    (acs_map['.'])
  1114. # define ACS_UARROW    (acs_map['-'])
  1115. # define ACS_BOARD    (acs_map['h'])
  1116. # define ACS_LANTERN    (acs_map['i'])
  1117. # define ACS_BLOCK    (acs_map['0'])
  1118.  
  1119. # define ACS_S3    (acs_map['p'])
  1120. # define ACS_S7    (acs_map['r'])
  1121. # define ACS_LEQUAL    (acs_map['y'])
  1122. # define ACS_GEQUAL    (acs_map['z'])
  1123. # define ACS_PI    (acs_map['{'])
  1124. # define ACS_NEQUAL    (acs_map['|'])
  1125. # define ACS_STERLING    (acs_map['}'])
  1126. #endif
  1127.  
  1128. #if defined(DOS) || defined(OS2) || defined(WIN32)
  1129. /* ALTCHARSET definitions from jshumate@wrdis01.robins.af.mil */
  1130. # define ACS_ULCORNER    (chtype)0xda            /* SysV        */
  1131. # define ACS_LLCORNER    (chtype)0xc0            /* SysV        */
  1132. # define ACS_URCORNER    (chtype)0xbf            /* SysV        */
  1133. # define ACS_LRCORNER    (chtype)0xd9            /* SysV        */
  1134. # define ACS_RTEE    (chtype)0xb4            /* SysV        */
  1135. # define ACS_LTEE    (chtype)0xc3            /* SysV        */
  1136. # define ACS_BTEE    (chtype)0xc1            /* SysV        */
  1137. # define ACS_TTEE    (chtype)0xc2            /* SysV        */
  1138. # define ACS_HLINE    (chtype)0xc4            /* SysV        */
  1139. # define ACS_VLINE    (chtype)0xb3            /* SysV        */
  1140. # define ACS_PLUS    (chtype)0xc5            /* SysV        */
  1141. # define ACS_S1    (chtype)0x2d            /* SysV        */
  1142. # define ACS_S9    (chtype)0x5f            /* SysV        */
  1143. # define ACS_DIAMOND    (chtype)0xc5            /* SysV        */
  1144. # define ACS_CKBOARD    (chtype)0xb2            /* SysV        */
  1145. # define ACS_DEGREE    (chtype)0xf8            /* SysV        */
  1146. # define ACS_PLMINUS    (chtype)0xf1            /* SysV        */
  1147. # define ACS_BULLET    (chtype)0xf9            /* SysV        */
  1148. # define ACS_LARROW    (chtype)0x3c            /* SysV        */
  1149. # define ACS_RARROW    (chtype)0x3e            /* SysV        */
  1150. # define ACS_DARROW    (chtype)0x76            /* SysV        */
  1151. # define ACS_UARROW    (chtype)0x5e            /* SysV        */
  1152. # define ACS_BOARD    (chtype)0x23            /* SysV        */
  1153. # define ACS_LANTERN    (chtype)0x23            /* SysV        */
  1154. # define ACS_BLOCK    (chtype)0x23            /* SysV        */
  1155.  
  1156. /* the following definitions can be used if you have set raw_output()
  1157.    or are using the PDCurses *raw*() functions                        */
  1158. # if 0
  1159. #  define ACS_DIAMOND    (chtype)0x04            /* SysV        */
  1160. #  define ACS_LARROW    (chtype)0x1b            /* SysV        */
  1161. #  define ACS_RARROW    (chtype)0x1a            /* SysV        */
  1162. #  define ACS_DARROW    (chtype)0x19            /* SysV        */
  1163. #  define ACS_UARROW    (chtype)0x18            /* SysV        */
  1164. #  define ACS_BOARD    (chtype)0xb0            /* SysV        */
  1165. #  define ACS_LANTERN    (chtype)0x0f            /* SysV        */
  1166. #  define ACS_BLOCK    (chtype)0xdb            /* SysV        */
  1167. # endif
  1168. #endif
  1169.  
  1170. /* colour attributes */
  1171. #if defined (XCURSES)
  1172. # define COLOR_BLACK        0
  1173. # define COLOR_RED        1
  1174. # define COLOR_GREEN        2
  1175. # define COLOR_YELLOW        3
  1176. # define COLOR_BLUE        4
  1177. # define COLOR_MAGENTA        5
  1178. # define COLOR_CYAN        6
  1179. # define COLOR_WHITE        7
  1180. #endif
  1181.  
  1182. #if defined(DOS) || defined(OS2)
  1183. # define COLOR_BLACK        0
  1184. # define COLOR_BLUE        1
  1185. # define COLOR_GREEN        2
  1186. # define COLOR_CYAN        3
  1187. # define COLOR_RED        4
  1188. # define COLOR_MAGENTA        5
  1189. # define COLOR_YELLOW        6
  1190. # define COLOR_WHITE        7
  1191. #endif
  1192.  
  1193. #if defined(WIN32)
  1194. # define MS_MOUSE_MOVED    0x0001
  1195. /*
  1196.  * These defines taken directly from windows.h to reduce
  1197.  * compilation time by only #include'ing <windows.h>
  1198.  * when absolutely necesssary. Cygnus-W32 #defines all of these
  1199.  * so we need to check for that.
  1200.  */
  1201. # ifndef FOREGROUND_BLUE
  1202. #  define FOREGROUND_BLUE    0x0001
  1203. # endif
  1204. # ifndef FOREGROUND_GREEN
  1205. #  define FOREGROUND_GREEN    0x0002
  1206. # endif
  1207. # ifndef FOREGROUND_RED
  1208. #  define FOREGROUND_RED    0x0004
  1209. # endif
  1210. # ifndef FOREGROUND_INTENSITY
  1211. #  define FOREGROUND_INTENSITY    0x0008        /* BOLD */
  1212. # endif
  1213. # ifndef BACKGROUND_BLUE
  1214. #  define BACKGROUND_BLUE    0x0010
  1215. # endif
  1216. # ifndef BACKGROUND_GREEN
  1217. #  define BACKGROUND_GREEN    0x0020
  1218. # endif
  1219. # ifndef BACKGROUND_RED
  1220. #  define BACKGROUND_RED    0x0040
  1221. # endif
  1222. # ifndef BACKGROUND_INTENSITY
  1223. #  define BACKGROUND_INTENSITY    0x0080        /* BLINK */
  1224. # endif
  1225.  
  1226. # define COLOR_BLACK        0
  1227. # define COLOR_BLUE        FOREGROUND_BLUE
  1228. # define COLOR_RED        FOREGROUND_RED
  1229. # define COLOR_GREEN        FOREGROUND_GREEN
  1230. # define COLOR_CYAN        FOREGROUND_BLUE | FOREGROUND_GREEN
  1231. # define COLOR_MAGENTA        FOREGROUND_RED | FOREGROUND_BLUE
  1232. # define COLOR_YELLOW        FOREGROUND_RED | FOREGROUND_GREEN
  1233. # define COLOR_WHITE        FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
  1234. #endif
  1235.  
  1236. #ifdef CHTYPE_LONG
  1237. #define COLOR_PAIR(n)  ((chtype)(n) << 24)
  1238. #define PAIR_NUMBER(n) (((n) & A_COLOR) >> 24)
  1239. #else
  1240. #define COLOR_PAIR(n)  (((n) << 11) & A_ATTRIBUTES)
  1241. #define PAIR_NUMBER(n) (((n) & A_COLOR) >> 11)
  1242. #endif
  1243.  
  1244. /*----------------------------------------------------------------------
  1245.  *
  1246.  *    Function and Keypad Key Definitions.
  1247.  *    Many are just for compatibility.
  1248.  *
  1249.  */
  1250. #define KEY_MIN         0x101   /* Minimum curses key value      */
  1251. #define KEY_BREAK       0x101   /* Not on PC KBD                 */
  1252. #define KEY_DOWN        0x102   /* Down arrow key                */
  1253. #define KEY_UP          0x103   /* Up arrow key                  */
  1254. #define KEY_LEFT        0x104   /* Left arrow key                */
  1255. #define KEY_RIGHT       0x105   /* Right arrow key               */
  1256. #define KEY_HOME        0x106   /* home key                      */
  1257. #define KEY_BACKSPACE   0x107   /* not on pc                     */
  1258. #define KEY_F0          0x108   /* function keys. space for      */
  1259. #define KEY_F(n)    (KEY_F0+(n))/* 64 keys are reserved.         */
  1260. #define KEY_DL         0x148   /* delete line                   */
  1261. #define KEY_IL         0x149   /* insert line                   */
  1262. #define KEY_DC         0x14a   /* delete character              */
  1263. #define KEY_IC         0x14b   /* insert char or enter ins mode */
  1264. #define KEY_EIC        0x14c   /* exit insert char mode         */
  1265. #define KEY_CLEAR      0x14d   /* clear screen                  */
  1266. #define KEY_EOS        0x14e   /* clear to end of screen        */
  1267. #define KEY_EOL        0x14f   /* clear to end of line          */
  1268. #define KEY_SF         0x150   /* scroll 1 line forward         */
  1269. #define KEY_SR         0x151   /* scroll 1 line back (reverse)  */
  1270. #define KEY_NPAGE      0x152   /* next page                     */
  1271. #define KEY_PPAGE      0x153   /* previous page                 */
  1272. #define KEY_STAB       0x154   /* set tab                       */
  1273. #define KEY_CTAB       0x155   /* clear tab                     */
  1274. #define KEY_CATAB      0x156   /* clear all tabs                */
  1275. #define KEY_ENTER      0x157   /* enter or send (unreliable)    */
  1276. #define KEY_SRESET     0x158   /* soft/reset (partial/unreliable)*/
  1277. #define KEY_RESET      0x159   /* reset/hard reset (unreliable) */
  1278. #define KEY_PRINT      0x15a   /* print/copy                    */
  1279. #define KEY_LL         0x15b   /* home down/bottom (lower left) */
  1280. #define KEY_ABORT      0x15c   /* abort/terminate key (any)     */
  1281. #define KEY_SHELP      0x15d   /* short help                    */
  1282. #define KEY_LHELP      0x15e   /* long help                     */
  1283. #define KEY_BTAB       0x15f   /* Back tab key                  */
  1284. #define KEY_BEG        0x160   /* beg(inning) key               */
  1285. #define KEY_CANCEL     0x161   /* cancel key                    */
  1286. #define KEY_CLOSE      0x162   /* close key                     */
  1287. #define KEY_COMMAND    0x163   /* cmd (command) key             */
  1288. #define KEY_COPY       0x164   /* copy key                      */
  1289. #define KEY_CREATE     0x165   /* create key                    */
  1290. #define KEY_END        0x166   /* end key                       */
  1291. #define KEY_EXIT       0x167   /* exit key                      */
  1292. #define KEY_FIND       0x168   /* find key                      */
  1293. #define KEY_HELP       0x169   /* help key                      */
  1294. #define KEY_MARK       0x16a   /* mark key                      */
  1295. #define KEY_MESSAGE    0x16b   /* message key                   */
  1296. #define KEY_MOVE       0x16c   /* move key                      */
  1297. #define KEY_NEXT       0x16d   /* next object key               */
  1298. #define KEY_OPEN       0x16e   /* open key                      */
  1299. #define KEY_OPTIONS    0x16f   /* options key                   */
  1300. #define KEY_PREVIOUS   0x170   /* previous object key           */
  1301. #define KEY_REDO       0x171   /* redo key                      */
  1302. #define KEY_REFERENCE  0x172   /* ref(erence) key               */
  1303. #define KEY_REFRESH    0x173   /* refresh key                   */
  1304. #define KEY_REPLACE    0x174   /* replace key                   */
  1305. #define KEY_RESTART    0x175   /* restart key                   */
  1306. #define KEY_RESUME     0x176   /* resume key                    */
  1307. #define KEY_SAVE       0x177   /* save key                      */
  1308. #define KEY_SBEG       0x178   /* shifted beginning key         */
  1309. #define KEY_SCANCEL    0x179   /* shifted cancel key            */
  1310. #define KEY_SCOMMAND   0x17a   /* shifted command key           */
  1311. #define KEY_SCOPY      0x17b   /* shifted copy key              */
  1312. #define KEY_SCREATE    0x17c   /* shifted create key            */
  1313. #define KEY_SDC        0x17d   /* shifted delete char key       */
  1314. #define KEY_SDL        0x17e   /* shifted delete line key       */
  1315. #define KEY_SELECT     0x17f   /* select key                    */
  1316. #define KEY_SEND       0x180   /* shifted end key               */
  1317. #define KEY_SEOL       0x181   /* shifted clear line key        */
  1318. #define KEY_SEXIT      0x182   /* shifted exit key              */
  1319. #define KEY_SFIND      0x183   /* shifted find key              */
  1320. #define KEY_SHOME      0x184   /* shifted home key              */
  1321. #define KEY_SIC        0x185   /* shifted input key             */
  1322. #define KEY_SLEFT      0x187   /* shifted left arrow key        */
  1323. #define KEY_SMESSAGE   0x188   /* shifted message key           */
  1324. #define KEY_SMOVE      0x189   /* shifted move key              */
  1325. #define KEY_SNEXT      0x18a   /* shifted next key              */
  1326. #define KEY_SOPTIONS   0x18b   /* shifted options key           */
  1327. #define KEY_SPREVIOUS  0x18c   /* shifted prev key              */
  1328. #define KEY_SPRINT     0x18d   /* shifted print key             */
  1329. #define KEY_SREDO      0x18e   /* shifted redo key              */
  1330. #define KEY_SREPLACE   0x18f   /* shifted replace key           */
  1331. #define KEY_SRIGHT     0x190   /* shifted right arrow           */
  1332. #define KEY_SRSUME     0x191   /* shifted resume key            */
  1333. #define KEY_SSAVE      0x192   /* shifted save key              */
  1334. #define KEY_SSUSPEND   0x193   /* shifted suspend key           */
  1335. #define KEY_SUNDO      0x194   /* shifted undo key              */
  1336. #define KEY_SUSPEND    0x195   /* suspend key                   */
  1337. #define KEY_UNDO       0x196   /* undo key                      */
  1338.  
  1339. /* PDCurses specific key definitions */
  1340.  
  1341. #define ALT_0           0x197   /* Alt-0                PC only  */
  1342. #define ALT_1           0x198   /* Alt-1                PC only  */
  1343. #define ALT_2           0x199   /* Alt-2                PC only  */
  1344. #define ALT_3           0x19a   /* Alt-3                PC only  */
  1345. #define ALT_4           0x19b   /* Alt-4                PC only  */
  1346. #define ALT_5           0x19c   /* Alt-5                PC only  */
  1347. #define ALT_6           0x19d   /* Alt-6                PC only  */
  1348. #define ALT_7           0x19e   /* Alt-7                PC only  */
  1349. #define ALT_8           0x19f   /* Alt-8                PC only  */
  1350. #define ALT_9           0x1a0   /* Alt-9                PC only  */
  1351. #define ALT_A           0x1a1   /* Alt-A                PC only  */
  1352. #define ALT_B           0x1a2   /* Alt-B                PC only  */
  1353. #define ALT_C           0x1a3   /* Alt-C                PC only  */
  1354. #define ALT_D           0x1a4   /* Alt-D                PC only  */
  1355. #define ALT_E           0x1a5   /* Alt-E                PC only  */
  1356. #define ALT_F           0x1a6   /* Alt-F                PC only  */
  1357. #define ALT_G           0x1a7   /* Alt-G                PC only  */
  1358. #define ALT_H           0x1a8   /* Alt-H                PC only  */
  1359. #define ALT_I           0x1a9   /* Alt-I                PC only  */
  1360. #define ALT_J           0x1aa   /* Alt-J                PC only  */
  1361. #define ALT_K           0x1ab   /* Alt-K                PC only  */
  1362. #define ALT_L           0x1ac   /* Alt-L                PC only  */
  1363. #define ALT_M           0x1ad   /* Alt-M                PC only  */
  1364. #define ALT_N           0x1ae   /* Alt-N                PC only  */
  1365. #define ALT_O           0x1af   /* Alt-O                PC only  */
  1366. #define ALT_P           0x1b0   /* Alt-P                PC only  */
  1367. #define ALT_Q           0x1b1   /* Alt-Q                PC only  */
  1368. #define ALT_R           0x1b2   /* Alt-R                PC only  */
  1369. #define ALT_S           0x1b3   /* Alt-S                PC only  */
  1370. #define ALT_T           0x1b4   /* Alt-T                PC only  */
  1371. #define ALT_U           0x1b5   /* Alt-U                PC only  */
  1372. #define ALT_V           0x1b6   /* Alt-V                PC only  */
  1373. #define ALT_W           0x1b7   /* Alt-W                PC only  */
  1374. #define ALT_X           0x1b8   /* Alt-X                PC only  */
  1375. #define ALT_Y           0x1b9   /* Alt-Y                PC only  */
  1376. #define ALT_Z           0x1ba   /* Alt-Z                PC only  */
  1377. #define CTL_LEFT        0x1bb   /* Control-Left-Arrow   PC only  */
  1378. #define CTL_RIGHT       0x1bc   /* Control-Right-Arrow  PC only  */
  1379. #define CTL_PGUP        0x1bd   /* Control-PgUp         PC only  */
  1380. #define CTL_PGDN        0x1be   /* Control-PgDn         PC only  */
  1381. #define CTL_HOME        0x1bf   /* Control-Home         PC only  */
  1382. #define CTL_END         0x1c0   /* Control-End          PC only  */
  1383.  
  1384. #if defined(FLEXOS)
  1385. # define KEY_MOUSE       0x1c1 /* "mouse" key  */
  1386. # define KEY_A1          KEY_HOME/* upper left on Virtual keypad  */
  1387. # define KEY_A2          KEY_UP  /* upper middle on Virt. keypad  */
  1388. # define KEY_A3          KEY_PPAGE/* upper right on Vir. keypad   */
  1389. # define KEY_B1          KEY_LEFT/* middle left on Virt. keypad   */
  1390. # define KEY_B2          0x00    /* center on Virt. keypad        */
  1391. # define KEY_B3          KEY_RIGHT/* middle right on Vir. keypad  */
  1392. # define KEY_C1          KEY_LL  /* lower left on Virt. keypad    */
  1393. # define KEY_C2          KEY_DOWN /* lower middle on Virt. keypad */
  1394. # define KEY_C3          KEY_NPAGE /* lower right on Vir. keypad  */
  1395. # define KEY_MAX         KEY_MOUSE /* Maximum curses key        */
  1396. #endif
  1397.  
  1398.  
  1399. #if defined(DOS)  || defined (OS2) || defined(XCURSES) || defined(WIN32)
  1400. # define KEY_A1          0x1c1   /* upper left on Virtual keypad  */
  1401. # define KEY_A2          0x1c2   /* upper middle on Virt. keypad  */
  1402. # define KEY_A3          0x1c3   /* upper right on Vir. keypad    */
  1403. # define KEY_B1          0x1c4   /* middle left on Virt. keypad   */
  1404. # define KEY_B2          0x1c5   /* center on Virt. keypad        */
  1405. # define KEY_B3          0x1c6   /* middle right on Vir. keypad   */
  1406. # define KEY_C1          0x1c7   /* lower left on Virt. keypad    */
  1407. # define KEY_C2          0x1c8   /* lower middle on Virt. keypad  */
  1408. # define KEY_C3          0x1c9   /* lower right on Vir. keypad    */
  1409. # define PADSLASH        0x1ca   /* slash on keypad               */
  1410. # define PADENTER        0x1cb   /* enter on keypad               */
  1411. # define CTL_PADENTER    0x1cc   /* ctl-enter on keypad           */
  1412. # define ALT_PADENTER    0x1cd   /* alt-enter on keypad           */
  1413. # define PADSTOP         0x1ce   /* stop on keypad                */
  1414. # define PADSTAR         0x1cf   /* star on keypad                */
  1415. # define PADMINUS        0x1d0   /* minus on keypad               */
  1416. # define PADPLUS         0x1d1   /* plus on keypad                */
  1417. # define CTL_PADSTOP     0x1d2   /* ctl-stop on keypad            */
  1418. # define CTL_PADCENTER   0x1d3   /* ctl-enter on keypad           */
  1419. # define CTL_PADPLUS     0x1d4   /* ctl-plus on keypad            */
  1420. # define CTL_PADMINUS    0x1d5   /* ctl-minus on keypad           */
  1421. # define CTL_PADSLASH    0x1d6   /* ctl-slash on keypad           */
  1422. # define CTL_PADSTAR     0x1d7   /* ctl-star on keypad            */
  1423. # define ALT_PADPLUS     0x1d8   /* alt-plus on keypad            */
  1424. # define ALT_PADMINUS    0x1d9   /* alt-minus on keypad           */
  1425. # define ALT_PADSLASH    0x1da   /* alt-slash on keypad           */
  1426. # define ALT_PADSTAR     0x1db   /* alt-star on keypad            */
  1427. # define ALT_PADSTOP     0x1dc   /* alt-star on keypad            */
  1428. # define CTL_INS         0x1dd   /* ctl-insert                    */
  1429. # define ALT_DEL         0x1de   /* alt-delete                    */
  1430. # define ALT_INS         0x1df   /* alt-insert                    */
  1431. # define CTL_UP          0x1e0   /* ctl-up arrow                  */
  1432. # define CTL_DOWN        0x1e1   /* ctl-down arrow                */
  1433. # define CTL_TAB         0x1e2   /* ctl-tab                       */
  1434. # define ALT_TAB         0x1e3   /* alt-tab                       */
  1435. # define ALT_MINUS       0x1e4   /* alt-minus                     */
  1436. # define ALT_EQUAL       0x1e5   /* alt-equal                     */
  1437. # define ALT_HOME        0x1e6   /* alt-home                      */
  1438. # define ALT_PGUP        0x1e7   /* alt-pgup                      */
  1439. # define ALT_PGDN        0x1e8   /* alt-pgdn                      */
  1440. # define ALT_END         0x1e9   /* alt-end                       */
  1441. # define ALT_UP          0x1ea   /* alt-up arrow                  */
  1442. # define ALT_DOWN        0x1eb   /* alt-down arrow                */
  1443. # define ALT_RIGHT       0x1ec   /* alt-right arrow               */
  1444. # define ALT_LEFT        0x1ed   /* alt-left arrow                */
  1445. # define ALT_ENTER       0x1ee   /* alt-enter                     */
  1446. # define ALT_ESC         0x1ef   /* alt-escape                    */
  1447. # define ALT_BQUOTE      0x1f0   /* alt-back quote                */
  1448. # define ALT_LBRACKET    0x1f1   /* alt-left bracket              */
  1449. # define ALT_RBRACKET    0x1f2   /* alt-right bracket             */
  1450. # define ALT_SEMICOLON   0x1f3   /* alt-semi-colon                */
  1451. # define ALT_FQUOTE      0x1f4   /* alt-forward quote             */
  1452. # define ALT_COMMA       0x1f5   /* alt-comma                     */
  1453. # define ALT_STOP        0x1f6   /* alt-stop                      */
  1454. # define ALT_FSLASH      0x1f7   /* alt-forward slash             */
  1455. # define ALT_BKSP        0x1f8   /* alt-backspace                 */
  1456. # define CTL_BKSP        0x1f9   /* ctl-backspace                 */
  1457. # define PAD0            0x1fa   /* ctl-keypad 0                  */
  1458. # define CTL_PAD0        0x1fb   /* ctl-keypad 0                  */
  1459. # define CTL_PAD1        0x1fc   /* ctl-keypad 1                  */
  1460. # define CTL_PAD2        0x1fd   /* ctl-keypad 2                  */
  1461. # define CTL_PAD3        0x1fe   /* ctl-keypad 3                  */
  1462. # define CTL_PAD4        0x1ff   /* ctl-keypad 4                  */
  1463. # define CTL_PAD5        0x200   /* ctl-keypad 5                  */
  1464. # define CTL_PAD6        0x201   /* ctl-keypad 6                  */
  1465. # define CTL_PAD7        0x202   /* ctl-keypad 7                  */
  1466. # define CTL_PAD8        0x203   /* ctl-keypad 8                  */
  1467. # define CTL_PAD9        0x204   /* ctl-keypad 9                  */
  1468. # define ALT_PAD0        0x205   /* ctl-keypad 0                  */
  1469. # define ALT_PAD1        0x206   /* ctl-keypad 1                  */
  1470. # define ALT_PAD2        0x207   /* ctl-keypad 2                  */
  1471. # define ALT_PAD3        0x208   /* ctl-keypad 3                  */
  1472. # define ALT_PAD4        0x209   /* ctl-keypad 4                  */
  1473. # define ALT_PAD5        0x20a   /* ctl-keypad 5                  */
  1474. # define ALT_PAD6        0x20b   /* ctl-keypad 6                  */
  1475. # define ALT_PAD7        0x20c   /* ctl-keypad 7                  */
  1476. # define ALT_PAD8        0x20d   /* ctl-keypad 8                  */
  1477. # define ALT_PAD9        0x20e   /* ctl-keypad 9                  */
  1478. # define CTL_DEL         0x20f   /* clt-delete                    */
  1479. # define ALT_BSLASH      0x210   /* alt-back slash                */
  1480. # define CTL_ENTER       0x211   /* ctl-enter                     */
  1481. # define SHF_PADENTER    0x212   /* shift-enter on keypad         */
  1482. # define SHF_PADSLASH    0x213   /* shift-slash on keypad         */
  1483. # define SHF_PADSTAR     0x214   /* shift-star  on keypad         */
  1484. # define SHF_PADPLUS     0x215   /* shift-plus  on keypad         */
  1485. # define SHF_PADMINUS    0x216   /* shift-minus on keypad         */
  1486. # define SHF_UP          0x217   /* shift-up on keypad            */
  1487. # define SHF_DOWN        0x218   /* shift-down on keypad          */
  1488. # define SHF_IC          0x219   /* shift-insert on keypad        */
  1489. # define SHF_DC          0x21a   /* shift-delete on keypad        */
  1490. # define KEY_MOUSE       0x21b   /* "mouse" key                   */
  1491. # define KEY_SHIFT_L     0x21c   /* Left-shift                    */
  1492. # define KEY_SHIFT_R     0x21d   /* Right-shift                   */
  1493. # define KEY_CONTROL_L   0x21e   /* Left-control                  */
  1494. # define KEY_CONTROL_R   0x21f   /* Right-control                 */
  1495. # define KEY_ALT_L       0x220   /* Left-alt                      */
  1496. # define KEY_ALT_R       0x221   /* Right-alt                     */
  1497. # define KEY_RESIZE      0x222   /* Window resize                 */
  1498. # define KEY_MAX         0x222   /* Maximum curses key            */
  1499. #endif
  1500.  
  1501. /*----------------------------------------------------------------------
  1502. *       PDCurses function declarations
  1503. */
  1504. #ifdef HAVE_PROTO
  1505. int     PDC_CDECL    addchnstr( chtype *, int );
  1506. int     PDC_CDECL    baudrate( void );
  1507. int     PDC_CDECL    beep( void );
  1508. int     PDC_CDECL    border( chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
  1509. int     PDC_CDECL    can_change_color ( void );
  1510. int     PDC_CDECL    clearok( WINDOW*, bool );
  1511. int     PDC_CDECL    color_content( short, short*, short*, short* );
  1512. int     PDC_CDECL    copywin( WINDOW*, WINDOW*, int, int, int, int, int, int, int );
  1513. int     PDC_CDECL    curs_set( int );
  1514. int     PDC_CDECL    def_prog_mode( void );
  1515. int     PDC_CDECL    def_shell_mode( void );
  1516. int     PDC_CDECL    delay_output(  int  );
  1517. int     PDC_CDECL    delwin( WINDOW* );
  1518. WINDOW* PDC_CDECL    derwin( WINDOW*, int, int, int, int );
  1519. int     PDC_CDECL    doupdate( void );
  1520. WINDOW* PDC_CDECL    dupwin( WINDOW* );
  1521. int     PDC_CDECL    endwin( void );
  1522. int     PDC_CDECL    erase( void );
  1523. char    PDC_CDECL    erasechar( void );
  1524. int     PDC_CDECL    flash( void );
  1525. int     PDC_CDECL    flushinp( void );
  1526. int     PDC_CDECL    getsyx( int*, int* );
  1527. int     PDC_CDECL    halfdelay( int );
  1528. bool    PDC_CDECL    has_colors( void );
  1529. int     PDC_CDECL    hline( chtype, int );
  1530. int     PDC_CDECL    immedok( WINDOW*, bool );
  1531. int     PDC_CDECL    inchnstr( chtype *, int );
  1532. int     PDC_CDECL    init_color( short, short, short, short );
  1533. int     PDC_CDECL    init_pair( short, short, short );
  1534. WINDOW* PDC_CDECL    initscr( void );
  1535. #ifdef XCURSES
  1536. WINDOW* PDC_CDECL    Xinitscr( int, char ** );
  1537. #endif
  1538. int     PDC_CDECL    intrflush(  WINDOW*, bool  );
  1539. int     PDC_CDECL    is_linetouched(WINDOW *,int);
  1540. int     PDC_CDECL    is_wintouched(WINDOW *);
  1541. char*   PDC_CDECL    keyname(  int  );
  1542. char    PDC_CDECL    killchar( void );
  1543. char*   PDC_CDECL    longname( void );
  1544. int     PDC_CDECL    meta( WINDOW*, bool );
  1545. int     PDC_CDECL    mvcur( int, int, int, int );
  1546. int     PDC_CDECL    mvderwin( WINDOW*, int, int );
  1547. #ifdef HAVE_STDARG_H
  1548. int     PDC_CDECL    mvprintw( int, int, char*,... );
  1549. int     PDC_CDECL    mvscanw( int, int, char*,... );
  1550. #endif
  1551. int     PDC_CDECL    mvwaddnstr( WINDOW*,int,int,char*,int );
  1552. int     PDC_CDECL    mvwin( WINDOW*, int, int );
  1553. int     PDC_CDECL    mvwinsertln( WINDOW*, int, int );
  1554. #ifdef HAVE_STDARG_H
  1555. int     PDC_CDECL    mvwprintw( WINDOW*, int, int, char*,... );
  1556. int     PDC_CDECL    mvwscanw( WINDOW*, int, int, char*,... );
  1557. #endif
  1558. WINDOW* PDC_CDECL    newpad( int, int );
  1559. SCREEN* PDC_CDECL    newterm( char*, FILE*, FILE* );
  1560. WINDOW* PDC_CDECL    newwin( int, int, int, int );
  1561. int     PDC_CDECL    noraw( void );
  1562. int     PDC_CDECL    notimeout( WINDOW *, bool );
  1563. int     PDC_CDECL    overlay( WINDOW*, WINDOW* );
  1564. int     PDC_CDECL    overwrite( WINDOW*, WINDOW* );
  1565. int     PDC_CDECL    pair_content( int, short*, short* );
  1566. int     PDC_CDECL    pnoutrefresh( WINDOW*, int, int, int, int, int, int );
  1567. int     PDC_CDECL    prefresh( WINDOW*, int, int, int, int, int, int );
  1568. #ifdef HAVE_STDARG_H
  1569. int     PDC_CDECL    printw( char*,... );
  1570. int     PDC_CDECL    scanw( char*,... );
  1571. #endif
  1572. int     PDC_CDECL    raw( void );
  1573. int     PDC_CDECL    refresh( void );
  1574. int     PDC_CDECL    reset_prog_mode( void );
  1575. int     PDC_CDECL    reset_shell_mode( void );
  1576. int     PDC_CDECL    resetty( void );
  1577. int     PDC_CDECL    ripoffline(int, int (*)(WINDOW *, int));
  1578. int     PDC_CDECL    savetty( void );
  1579. int     PDC_CDECL    sb_init(void);
  1580. int     PDC_CDECL    sb_set_horz(int, int, int);
  1581. int     PDC_CDECL    sb_set_vert(int, int, int);
  1582. int     PDC_CDECL    sb_get_horz(int *, int *, int *);
  1583. int     PDC_CDECL    sb_get_vert(int *, int *, int *);
  1584. int     PDC_CDECL    sb_refresh(void);
  1585. int     PDC_CDECL    scroll( WINDOW* );
  1586. SCREEN* PDC_CDECL    set_term( SCREEN* );
  1587. int     PDC_CDECL    setsyx( int, int );
  1588. int     PDC_CDECL    start_color( void );
  1589. int     PDC_CDECL    slk_init(int);
  1590. int     PDC_CDECL    slk_set(int, char *, int);
  1591. int     PDC_CDECL    slk_refresh(void);
  1592. int     PDC_CDECL    slk_noutrefresh(void);
  1593. char*   PDC_CDECL    slk_label(int);
  1594. int     PDC_CDECL    slk_clear(void);
  1595. int     PDC_CDECL    slk_restore(void);
  1596. int     PDC_CDECL    slk_touch(void);
  1597. int     PDC_CDECL    slk_attron(attr_t);
  1598. int     PDC_CDECL    slk_attrset(attr_t);
  1599. int     PDC_CDECL    slk_attroff(attr_t);
  1600. WINDOW* PDC_CDECL    subpad( WINDOW*, int, int, int, int );
  1601. WINDOW* PDC_CDECL    subwin( WINDOW*, int, int, int, int );
  1602. int     PDC_CDECL    syncok(WINDOW*, bool);
  1603. attr_t  PDC_CDECL    termattrs( void );
  1604. char*   PDC_CDECL    termname( void );
  1605. int     PDC_CDECL    touchline( WINDOW*, int ,int );
  1606. int     PDC_CDECL    touchwin( WINDOW* );
  1607. #if !defined (CURSES_LIBRARY)
  1608. void    PDC_CDECL    traceoff( void );
  1609. void    PDC_CDECL    traceon( void );
  1610. #endif
  1611. int     PDC_CDECL    typeahead( int );
  1612. char*   PDC_CDECL    unctrl( chtype );
  1613. int     PDC_CDECL    vline( chtype, int );
  1614. int     PDC_CDECL    waddchnstr( WINDOW*, chtype*, int );
  1615. int     PDC_CDECL    waddnstr( WINDOW*, char*, int );
  1616. int     PDC_CDECL    waddstr( WINDOW*, char* );
  1617. int     PDC_CDECL    wattroff( WINDOW*, attr_t );
  1618. int     PDC_CDECL    wattron( WINDOW*, attr_t );
  1619. int     PDC_CDECL    wattrset( WINDOW*, attr_t );
  1620. int     PDC_CDECL    wbkgd(WINDOW*, chtype);
  1621. void    PDC_CDECL    wbkgdset(WINDOW*, chtype);
  1622. int     PDC_CDECL    wborder( WINDOW*, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
  1623. int     PDC_CDECL    wclear( WINDOW* );
  1624. int     PDC_CDECL    wclrtobot( WINDOW* );
  1625. int     PDC_CDECL    wclrtoeol( WINDOW* );
  1626. void    PDC_CDECL    wcursyncup(WINDOW*);
  1627. int     PDC_CDECL    wdelch( WINDOW* );
  1628. int     PDC_CDECL    wdeleteln( WINDOW* );
  1629. int     PDC_CDECL    werase( WINDOW* );
  1630. int     PDC_CDECL    wgetch( WINDOW* );
  1631. int     PDC_CDECL    wgetnstr( WINDOW*, char*, int );
  1632. int     PDC_CDECL    wgetstr( WINDOW*, char* );
  1633. int     PDC_CDECL    whline( WINDOW*, chtype, int );
  1634. int     PDC_CDECL    winchnstr( WINDOW*, chtype*, int );
  1635. int     PDC_CDECL    winnstr( WINDOW*, char*, int );
  1636. int     PDC_CDECL    winsch( WINDOW*, chtype );
  1637. int     PDC_CDECL    winsdelln( WINDOW*, int );
  1638. int     PDC_CDECL    winsertln( WINDOW* );
  1639. int     PDC_CDECL    winsnstr( WINDOW*, char*, int );
  1640. int     PDC_CDECL    wmove( WINDOW*, int, int );
  1641. int     PDC_CDECL    wnoutrefresh( WINDOW* );
  1642. char    PDC_CDECL    wordchar( void );
  1643. #ifdef HAVE_STDARG_H
  1644. int     PDC_CDECL    wprintw( WINDOW*, char*,... );
  1645. int     PDC_CDECL    wscanw( WINDOW*, char*,... );
  1646. #endif
  1647. int     PDC_CDECL    wredrawln( WINDOW*, int ,int );
  1648. int     PDC_CDECL    wrefresh( WINDOW* );
  1649. int     PDC_CDECL    wscrl( WINDOW*, int );
  1650. int     PDC_CDECL    wsetscrreg( WINDOW*, int, int );
  1651. int     PDC_CDECL    wtimeout( WINDOW *, int );
  1652. int     PDC_CDECL    wtouchln(WINDOW *, int, int, int);
  1653. void    PDC_CDECL    wsyncdown(WINDOW*);
  1654. void    PDC_CDECL    wsyncup(WINDOW*);
  1655. int     PDC_CDECL    wvline( WINDOW*, chtype, int );
  1656.  
  1657. #ifdef  PDCURSES
  1658. int     PDC_CDECL    raw_output( bool );
  1659. int     PDC_CDECL    resize_term( int, int );
  1660. WINDOW* PDC_CDECL    resize_window( WINDOW*, int, int );
  1661. #endif
  1662.  
  1663. #ifdef OBSOLETE_OR_TBD
  1664. char    PDC_CDECL    breakchar( /* void */ );
  1665. int     PDC_CDECL    cursoff( /* void */ );
  1666. int     PDC_CDECL    curson( /* void */ );
  1667. int     PDC_CDECL    gettmode( /* void */ );
  1668. int     PDC_CDECL    mvaddrawch( /* int, int, chtype */ );
  1669. int     PDC_CDECL    mvaddrawstr( /* int, int, char* */ );
  1670. int     PDC_CDECL    mvwinsrawch( /* WINDOW*, int, int, chtype */ );
  1671. int     PDC_CDECL    mvinsrawch( /* int, int, chtype */ );
  1672. int     PDC_CDECL    saveoldterm( /* void */ );
  1673. int     PDC_CDECL    tabsize( /* int */ );
  1674. int     PDC_CDECL    waddrawstr( /* WINDOW*, char* */ );
  1675. int     PDC_CDECL    wtabsize( /* WINDOW*, int */ );
  1676. int     PDC_CDECL    win_print( /* WINDOW*, int */ );
  1677. #endif
  1678.  
  1679. #ifdef  XCURSES
  1680. void    XCursesExit( void );
  1681. int     nocbreak( void );
  1682. int     cbreak( void );
  1683. int     nocrmode( void );
  1684. int     crmode( void );
  1685. int     noecho( void );
  1686. int     echo( void );
  1687. int     nodelay( WINDOW *,bool );
  1688. #endif
  1689.  
  1690. int     PDC_CDECL    mouse_set( unsigned long );
  1691. int     PDC_CDECL    mouse_on( unsigned long );
  1692. int     PDC_CDECL    mouse_off( unsigned long );
  1693. int     PDC_CDECL    request_mouse_pos( void );
  1694. int     PDC_CDECL    map_button( unsigned long );
  1695. void    PDC_CDECL    wmouse_position( WINDOW *, int *, int * );
  1696. unsigned long PDC_CDECL    getmouse( void );
  1697. unsigned long PDC_CDECL    getbmap( void );
  1698.  
  1699. /*
  1700. *       Keep the compiler happy with our macros below...
  1701. */
  1702. int     PDC_CDECL    PDC_chadd( WINDOW*, chtype, bool, bool );
  1703. int     PDC_CDECL    PDC_chins( WINDOW*, chtype, bool );
  1704. int     PDC_CDECL    PDC_ungetch( int );
  1705.  
  1706. void    PDC_CDECL    PDC_set_title( char * );
  1707.  
  1708. int     PDC_CDECL    PDC_getclipboard( char **, long * );
  1709. int     PDC_CDECL    PDC_setclipboard( char *, long );
  1710.  
  1711. int     PDC_CDECL    PDC_get_input_fd( void );
  1712. unsigned long PDC_CDECL    PDC_get_key_modifiers( void );
  1713.  
  1714. #else
  1715.  
  1716. int     PDC_CDECL    addchnstr( /* chtype *, int */ );
  1717. int     PDC_CDECL    baudrate( /* void */ );
  1718. int     PDC_CDECL    beep( /* void */ );
  1719. int     PDC_CDECL    border( /* chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype */ );
  1720. int     PDC_CDECL    can_change_color ( /* void */ );
  1721. int     PDC_CDECL    clearok( /* WINDOW*, bool */ );
  1722. int     PDC_CDECL    color_content( /* int, short*, short*, short* */ );
  1723. int     PDC_CDECL    copywin( /* WINDOW*, WINDOW*, int, int, int, int, int, int, int */ );
  1724. int     PDC_CDECL    curs_set( /* int */ );
  1725. int     PDC_CDECL    def_prog_mode( /* void */ );
  1726. int     PDC_CDECL    def_shell_mode( /* void */ );
  1727. int     PDC_CDECL    delay_output( /*  int  */ );
  1728. int     PDC_CDECL    delwin( /* WINDOW* */ );
  1729. WINDOW* PDC_CDECL    derwin( /* WINDOW*, int, int, int, int */ );
  1730. int     PDC_CDECL    doupdate( /* void */ );
  1731. WINDOW* PDC_CDECL    dupwin( /* WINDOW* */ );
  1732. int     PDC_CDECL    endwin( /* void */ );
  1733. int     PDC_CDECL    erase( /* void */ );
  1734. char    PDC_CDECL    erasechar( /* void */ );
  1735. int     PDC_CDECL    flash( /* void */ );
  1736. int     PDC_CDECL    flushinp( /* void */ );
  1737. int     PDC_CDECL    getsyx( /* int*, int* */ );
  1738. int     PDC_CDECL    halfdelay( /* int */ );
  1739. bool    PDC_CDECL    has_colors( /* void */ );
  1740. int     PDC_CDECL    hline( /* chtype, int */ );
  1741. int     PDC_CDECL    immedok( /* WINDOW*, bool */ );
  1742. int     PDC_CDECL    inchnstr( /* chtype *, int */ );
  1743. int     PDC_CDECL    init_color( /* short, short, short, short */ );
  1744. int     PDC_CDECL    init_pair( /* short, short, short */ );
  1745. WINDOW* PDC_CDECL    initscr( /* void */ );
  1746. #ifdef XCURSES
  1747. WINDOW* PDC_CDECL    Xinitscr( /* int, char ** */ );
  1748. #endif
  1749. int     PDC_CDECL    intrflush( /*  WINDOW*, bool  */ );
  1750. int     PDC_CDECL    is_linetouched( /*WINDOW *,int*/ );
  1751. int     PDC_CDECL    is_wintouched( /*WINDOW **/ );
  1752. char*   PDC_CDECL    keyname( /*  int  */ );
  1753. char    PDC_CDECL    killchar( /* void */ );
  1754. char*   PDC_CDECL    longname( /* void */ );
  1755. int     PDC_CDECL    meta( /* WINDOW*, bool */ );
  1756. int     PDC_CDECL    mvcur( /* int, int, int, int */ );
  1757. int     PDC_CDECL    mvderwin( /* WINDOW*, int, int */ );
  1758. int     PDC_CDECL    mvprintw( /* int, int, char*,... */ );
  1759. int     PDC_CDECL    mvscanw( /* int, int, char*,... */ );
  1760. int     PDC_CDECL    mvwaddnstr(/* WINDOW*,int,int,char*,int */ );
  1761. int     PDC_CDECL    mvwin( /* WINDOW*, int, int */ );
  1762. int     PDC_CDECL    mvwinsertln( /* WINDOW*, int, int */ );
  1763. int     PDC_CDECL    mvwprintw( /* WINDOW*, int, int, char*,... */ );
  1764. int     PDC_CDECL    mvwscanw( /* WINDOW*, int, int, char*,... */ );
  1765. WINDOW* PDC_CDECL    newpad( /* int, int */ );
  1766. SCREEN* PDC_CDECL    newterm( /* char*, FILE*, FILE* */ );
  1767. WINDOW* PDC_CDECL    newwin( /* int, int, int, int */ );
  1768. int     PDC_CDECL    noraw( /* void */ );
  1769. int     PDC_CDECL    notimeout( /* WINDOW *, bool */ );
  1770. int     PDC_CDECL    overlay( /* WINDOW*, WINDOW* */ );
  1771. int     PDC_CDECL    overwrite( /* WINDOW*, WINDOW* */ );
  1772. int     PDC_CDECL    pair_content( /* int, short*, short* */ );
  1773. int     PDC_CDECL    pnoutrefresh( /* WINDOW*, int, int, int, int, int, int */ );
  1774. int     PDC_CDECL    prefresh( /* WINDOW*, int, int, int, int, int, int */ );
  1775. int     PDC_CDECL    printw( /* char*,... */ );
  1776. int     PDC_CDECL    raw( /* void */ );
  1777. int     PDC_CDECL    refresh( /* void */ );
  1778. int     PDC_CDECL    reset_prog_mode( /* void */ );
  1779. int     PDC_CDECL    reset_shell_mode( /* void */ );
  1780. int     PDC_CDECL    resetty( /* void */ );
  1781. int     PDC_CDECL    ripoffline( /* int, int (*)(WINDOW *, int) */);
  1782. int     PDC_CDECL    savetty( /* void */ );
  1783. int     PDC_CDECL    sb_init( /* void */ );
  1784. int     PDC_CDECL    sb_set_horz( /* int, int, int */ );
  1785. int     PDC_CDECL    sb_set_vert( /* int, int, int */ );
  1786. int     PDC_CDECL    sb_get_horz( /* int *, int *, int * */ );
  1787. int     PDC_CDECL    sb_get_vert( /* int *, int *, int * */ );
  1788. int     PDC_CDECL    sb_refresh( /* void */ );
  1789. int     PDC_CDECL    scanw( /* char*,... */ );
  1790. int     PDC_CDECL    scroll( /* WINDOW* */ );
  1791. int     PDC_CDECL    setsyx( /* int, int */ );
  1792. SCREEN* PDC_CDECL    set_term( /* SCREEN* */ );
  1793. int     PDC_CDECL    slk_init(/* int */);
  1794. int     PDC_CDECL    slk_set(/* int, char *, int */);
  1795. int     PDC_CDECL    slk_refresh(/* void */);
  1796. int     PDC_CDECL    slk_noutrefresh(/* void */);
  1797. char*   PDC_CDECL    slk_label(/* int */);
  1798. int     PDC_CDECL    slk_clear(/* void */);
  1799. int     PDC_CDECL    slk_restore(/* void */);
  1800. int     PDC_CDECL    slk_touch(/* void */);
  1801. int     PDC_CDECL    slk_attron(/* attr_t */);
  1802. int     PDC_CDECL    slk_attrset(/* attr_t */);
  1803. int     PDC_CDECL    slk_attroff(/* attr_t */);
  1804. int     PDC_CDECL    start_color( /* void */ );
  1805. WINDOW* PDC_CDECL    subpad( /* WINDOW*, int, int, int, int */ );
  1806. WINDOW* PDC_CDECL    subwin( /* WINDOW*, int, int, int, int */ );
  1807. int     PDC_CDECL    syncok(/* WINDOW*, bool */);
  1808. attr_t  PDC_CDECL    termattrs( /* void */ );
  1809. char*   PDC_CDECL    termname( /* void */ );
  1810. int     PDC_CDECL    touchline( /* WINDOW*, int ,int */ );
  1811. int     PDC_CDECL    touchwin( /* WINDOW* */ );
  1812. #if !defined (CURSES_LIBRARY)
  1813. void    PDC_CDECL    traceoff(/* void */);
  1814. void    PDC_CDECL    traceon(/* void */);
  1815. #endif
  1816. int     PDC_CDECL    typeahead( /* int */ );
  1817. char*   PDC_CDECL    unctrl( /* chtype */ );
  1818. int     PDC_CDECL    vline( /* chtype, int */ );
  1819. int     PDC_CDECL    waddchnstr( /* WINDOW*, chtype*, int */ );
  1820. int     PDC_CDECL    waddnstr( /* WINDOW*, char*, int */ );
  1821. int     PDC_CDECL    waddstr( /* WINDOW*, char* */ );
  1822. int     PDC_CDECL    wattroff( /* WINDOW*, attr_t */ );
  1823. int     PDC_CDECL    wattron( /* WINDOW*, attr_t */ );
  1824. int     PDC_CDECL    wattrset( /* WINDOW*, attr_t */ );
  1825. int     PDC_CDECL    wbkgd( /*WINDOW*, chtype*/ );
  1826. void    PDC_CDECL    wbkgdset( /*WINDOW*, chtype*/ );
  1827. int     PDC_CDECL    wborder( /* WINDOW*, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype */ );
  1828. int     PDC_CDECL    wclear( /* WINDOW* */ );
  1829. int     PDC_CDECL    wclrtobot( /* WINDOW* */ );
  1830. int     PDC_CDECL    wclrtoeol( /* WINDOW* */ );
  1831. void    PDC_CDECL    wcursyncup(/* WINDOW* */);
  1832. int     PDC_CDECL    wdelch( /* WINDOW* */ );
  1833. int     PDC_CDECL    wdeleteln( /* WINDOW* */ );
  1834. int     PDC_CDECL    werase( /* WINDOW* */ );
  1835. int     PDC_CDECL    wgetch( /* WINDOW* */ );
  1836. int     PDC_CDECL    wgetnstr( /* WINDOW*, char*, int */ );
  1837. int     PDC_CDECL    wgetstr( /* WINDOW*, char* */ );
  1838. int     PDC_CDECL    whline( /* WINDOW*, chtype, int */ );
  1839. int     PDC_CDECL    winchnstr( /* WINDOW*, chtype*, int */ );
  1840. int     PDC_CDECL    winnstr( /* WINDOW*, char*, int */ );
  1841. int     PDC_CDECL    winsch( /* WINDOW*, chtype */ );
  1842. int     PDC_CDECL    winsdelln( /* WINDOW*, int */ );
  1843. int     PDC_CDECL    winsertln( /* WINDOW* */ );
  1844. int     PDC_CDECL    winsnstr( /* WINDOW*, char*, int */ );
  1845. int     PDC_CDECL    wmove( /* WINDOW*, int, int */ );
  1846. int     PDC_CDECL    wnoutrefresh( /* WINDOW* */ );
  1847. char    PDC_CDECL    wordchar( /* void */ );
  1848. int     PDC_CDECL    wprintw( /* WINDOW*, char*,... */ );
  1849. int     PDC_CDECL    wredrawln( /* WINDOW*, int ,int */ );
  1850. int     PDC_CDECL    wrefresh( /* WINDOW* */ );
  1851. int     PDC_CDECL    wscanw( /* WINDOW*, char*,... */ );
  1852. int     PDC_CDECL    wscrl( /* WINDOW*, int */ );
  1853. int     PDC_CDECL    wsetscrreg( /* WINDOW*, int, int */ );
  1854. int     PDC_CDECL    wtimeout( /* WINDOW *, int */ );
  1855. int     PDC_CDECL    wtouchln( /*WINDOW *, int, int, int*/ );
  1856. void    PDC_CDECL    wsyncdown(/* WINDOW* */);
  1857. void    PDC_CDECL    wsyncup(/* WINDOW* */);
  1858. int     PDC_CDECL    wvline( /* WINDOW*, chtype, int */ );
  1859.  
  1860. #ifdef  PDCURSES
  1861. int     PDC_CDECL    raw_output( /* bool */ );
  1862. int     PDC_CDECL    resize_term( /* int, int */ );
  1863. WINDOW* PDC_CDECL    resize_window( /* WINDOW*, int, int */ );
  1864. #endif
  1865.  
  1866. #ifdef OBSOLETE_OR_TBD
  1867. char    PDC_CDECL    breakchar( /* void */ );
  1868. int     PDC_CDECL    cursoff( /* void */ );
  1869. int     PDC_CDECL    curson( /* void */ );
  1870. int     PDC_CDECL    gettmode( /* void */ );
  1871. int     PDC_CDECL    mvaddrawch( /* int, int, chtype */ );
  1872. int     PDC_CDECL    mvaddrawstr( /* int, int, char* */ );
  1873. int     PDC_CDECL    mvwinsrawch( /* WINDOW*, int, int, chtype */ );
  1874. int     PDC_CDECL    mvinsrawch( /* int, int, chtype */ );
  1875. int     PDC_CDECL    saveoldterm( /* void */ );
  1876. int     PDC_CDECL    tabsize( /* int */ );
  1877. int     PDC_CDECL    waddrawstr( /* WINDOW*, char* */ );
  1878. int     PDC_CDECL    wtabsize( /* WINDOW*, int */ );
  1879. int     PDC_CDECL    win_print( /* WINDOW*, int */ );
  1880. #endif
  1881.  
  1882. #ifdef  XCURSES
  1883. void    XCursesExit(/* void */);
  1884. int     nocbreak( /* void */ );
  1885. int     cbreak( /* void */ );
  1886. int     nocrmode( /* void */ );
  1887. int     crmode( /* void */ );
  1888. int     noecho( /* void */ );
  1889. int     echo( /* void */ );
  1890. int     nodelay( /* WINDOW *,bool */ );
  1891. #endif
  1892.  
  1893. int     PDC_CDECL    mouse_set( /* long */ );
  1894. int     PDC_CDECL    mouse_on( /* long */ );
  1895. int     PDC_CDECL    mouse_off( /* long */ );
  1896. int     PDC_CDECL    request_mouse_pos( /* void */ );
  1897. int     PDC_CDECL    map_button( /* unsigned long */ );
  1898. void    PDC_CDECL    wmouse_position( /* WINDOW *, int *, int * */ );
  1899. unsigned long PDC_CDECL    getmouse( /* void */ );
  1900. unsigned long PDC_CDECL    getbmap( /* void */ );
  1901.  
  1902. /*
  1903. *       Keep the compiler happy with our macros below...
  1904. */
  1905. int     PDC_CDECL    PDC_chadd( /* WINDOW*, chtype, bool, bool */ );
  1906. int     PDC_CDECL    PDC_chins( /* WINDOW*, chtype, bool */ );
  1907. int     PDC_CDECL    PDC_ungetch( /* int */ );
  1908.  
  1909. void    PDC_CDECL    PDC_set_title( /* char * */ );
  1910. int     PDC_CDECL    PDC_getclipboard( /* char **, long * */ );
  1911. int     PDC_CDECL    PDC_setclipboard( /* char *, long */ );
  1912.  
  1913. int     PDC_CDECL    PDC_get_input_fd( /* void */ );
  1914. unsigned long PDC_CDECL    PDC_get_key_modifiers( /* void */ );
  1915.  
  1916. #endif
  1917.  
  1918.  
  1919. #ifndef max
  1920. # define max(a,b) (((a) > (b)) ? (a) : (b))
  1921. #endif
  1922. #ifndef min
  1923. # define min(a,b) (((a) < (b)) ? (a) : (b))
  1924. #endif
  1925.  
  1926. /*
  1927. *       Functions defined as macros
  1928. */
  1929.  
  1930. #define addch( c )              waddch( stdscr, c )
  1931. #define addchstr( c )           addchnstr( c, -1 )
  1932. #define addstr(str)             waddstr( stdscr, str )
  1933. #define addnstr(str, n)         waddnstr( stdscr, str, n )
  1934. #define attroff(attr)           wattroff( stdscr, attr )
  1935. #define attron(attr)            wattron( stdscr, attr )
  1936. #define attrset(attr)           wattrset( stdscr, attr )
  1937. #define bkgd(c)                 wbkgd(stdscr,c)
  1938. #define bkgdset(c)              wbkgdset(stdscr,c)
  1939. #define border(ls,rs,ts,bs,tl,tr,bl,br)  wborder(stdscr,ls,rs,ts,bs,tl,tr,bl,br)
  1940. #define box( w, v, h )          wborder( w, v, v, h, h, 0, 0, 0, 0 )
  1941. #define clear()                 wclear( stdscr )
  1942. #define clrtobot()              wclrtobot( stdscr )
  1943. #define clrtoeol()              wclrtoeol( stdscr )
  1944. #define delch()                 wdelch( stdscr )
  1945. #define deleteln()              wdeleteln( stdscr )
  1946. #define derwin(w,nl,nc,by,bx)   subwin((w),(nl),(nc),(by+(w)->_begy),(bx+(w)->_begx))
  1947. #define draino(ms)              delay_output(ms)
  1948. #define echochar(c)             (addch((chtype)c)==ERR?ERR:refresh())
  1949. #define erase()                 werase( stdscr )
  1950. #define fixterm()               reset_prog_mode()
  1951. #define getbegx(w)              (w)->_begx
  1952. #define getbegy(w)              (w)->_begy
  1953. #define getbegyx(w,y,x)         ( y = (w)->_begy, x = (w)->_begx )
  1954. #define getch()                 wgetch(stdscr)
  1955. #define getmaxx(w)              (w)->_maxx
  1956. #define getmaxy(w)              (w)->_maxy
  1957. #define getmaxyx(w,y,x)         ( y = (w)->_maxy, x = (w)->_maxx )
  1958. #define getparx(w)              (w)->_parx
  1959. #define getpary(w)              (w)->_pary
  1960. #define getparyx(w,y,x)         ( y = (w)->_pary, x = (w)->_parx )
  1961. #define getstr(str)             wgetstr( stdscr, str )
  1962. #define getnstr(str)            wgetnstr( stdscr, str, num )
  1963. #define getyx(w,y,x)            ( y = (w)->_cury, x = (w)->_curx )
  1964. #define has_colors()            ((SP->mono) ? FALSE : TRUE)
  1965. #define idcok(w,flag)           OK
  1966. #define idlok(w,flag)           OK
  1967. #define inch()                  (stdscr->_y[stdscr->_cury][stdscr->_curx])
  1968. #define inchstr( c )            inchnstr( c, stdscr->_maxx-stdscr->_curx )
  1969. #define innstr(str,n)           winnstr(stdscr,(str),(n))
  1970. #define insch( c )              winsch( stdscr, c )
  1971. #define insdelln(n)             winsdelln(stdscr,n)
  1972. #define insertln()              winsertln( stdscr )
  1973. #define insnstr(s,n)            winsnstr(stdscr,s,n)
  1974. #define insstr(s)               winsnstr(stdscr,s,(-1))
  1975. #define instr(str)              winnstr(stdscr,(str),stdscr->_maxx)
  1976. #define isendwin()              ((SP->alive) ? FALSE : TRUE)
  1977. #define is_termresized()        (SP->resized)
  1978. #define keypad(w,flag)          (w->_use_keypad  = flag)
  1979. #define leaveok(w,flag)         (w->_leaveit = flag)
  1980. #define move(y,x)               wmove( stdscr, y, x )
  1981. #define mvaddch(y,x,c)          (move( y, x )==ERR?ERR:addch( c ))
  1982. #define mvaddchstr(y,x,c)       (move( y, x )==ERR?ERR:addchnstr( c, -1 ))
  1983. #define mvaddchnstr(y,x,c,n)    (move( y, x )==ERR?ERR:addchnstr( c, n ))
  1984. #define mvaddstr(y,x,str)       (move( y, x )==ERR?ERR:addstr( str ))
  1985. #define mvaddnstr(y,x,str,n)    (move( y, x )==ERR?ERR:addnstr( str, n ))
  1986. #define mvdelch(y,x)            (move( y, x )==ERR?ERR:wdelch( stdscr ))
  1987. #define mvgetch(y,x)            (move( y, x )==ERR?ERR:wgetch(stdscr))
  1988. #define mvgetstr(y,x,str)       (move( y, x )==ERR?ERR:wgetstr( stdscr, str ))
  1989. #define mvinch(y,x)             (move( y, x )==ERR?ERR:(stdscr->_y[y][x]))
  1990. #define mvinchstr(y,x,c)        (move( y, x )==ERR?ERR:inchnstr( c, stdscr->_maxx-stdscr->_curx ))
  1991. #define mvinchnstr(y,x,c,n)     (move( y, x )==ERR?ERR:inchnstr( c, n ))
  1992. #define mvinsch(y,x,c)          (move( y, x )==ERR?ERR:winsch( stdscr, c ))
  1993. #define mvinsnstr(y,x,s,n)      (move( y, x )==ERR?ERR:winsnstr(stdscr,s,n))
  1994. #define mvinsstr(y,x,s)         (move( y, x )==ERR?ERR:winsnstr(stdscr,s,(-1)))
  1995. #define mvinstr(y,x,str)        (move( y, x )==ERR?ERR:winnstr(stdscr,(str),stdscr->_maxx))
  1996. #define mvinnstr(y,x,str,n)     (move( y, x )==ERR?ERR:winnstr(stdscr,(str),(n)))
  1997. #define mvwaddch(w,y,x,c)       (wmove( w, y, x )==ERR?ERR:waddch( w, c ))
  1998. #define mvwaddchstr(w,y,x,c)    (wmove( w, y, x )==ERR?ERR:waddchnstr( w, c, -1 ))
  1999. #define mvwaddchnstr(w,y,x,c,n) (wmove( w, y, x )==ERR?ERR:waddchnstr( w, c, n ))
  2000. #define mvwaddrawch(w,y,x,c)    (wmove( w, y, x )==ERR?ERR:waddrawch( w, c ))
  2001. #define mvwaddrawstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:waddrawstr( w, str ))
  2002. #define mvwaddstr(w,y,x,str)    (wmove( w, y, x )==ERR?ERR:waddstr( w, str ))
  2003. #define mvwdelch(w,y,x)         (wmove( w, y, x )==ERR?ERR:wdelch( w ))
  2004. #define mvwgetch(w,y,x)         (wmove( w, y, x )==ERR?ERR:wgetch( w ))
  2005. #define mvwgetstr(w,y,x,str)    (wmove( w, y, x )==ERR?ERR:wgetstr( w, str ))
  2006. #define mvwinch(w,y,x)          (wmove( w, y, x )==ERR?ERR:((w)->_y[y][x]))
  2007. #define mvwinchstr(w,y,x,c)     (wmove( w, y, x )==ERR?ERR:winchnstr( w, c, (w)->_maxx-(w)->_curx ))
  2008. #define mvwinchnstr(w,y,x,c,n)  (wmove( w, y, x )==ERR?ERR:winchnstr( w, c, n ))
  2009. #define mvwinsch(w,y,x,c)       (wmove( w, y, x )==ERR?ERR:winsch( w, c ))
  2010. #define mvwinstr(w,y,x,str)     (wmove( w, y, x )==ERR?ERR:winnstr(w,str,(w)->_maxx))
  2011. #define mvwinnstr(w,y,x,str,n)  (wmove( w, y, x )==ERR?ERR:winnstr(w,str,n))
  2012. #define mvwinsnstr(w,y,x,s,n)   (wmove( w, y, x )==ERR?ERR:winsnstr(w,s,n))
  2013. #define mvwinsstr(w,y,x,s)      (wmove( w, y, x )==ERR?ERR:winsnstr(w,s,(-1)))
  2014. #define napms(ms)               delay_output(ms)
  2015. #define nl()                    (SP->autocr = TRUE)
  2016. #define nonl()                  (SP->autocr = FALSE)
  2017. #define pechochar(w,c)          (waddch(w,(chtype)c)==ERR?ERR:prefresh(w))
  2018. #define redrawwin(w)            wredrawln((w),0,(win)->_maxy)
  2019. #define refresh()               wrefresh( stdscr )
  2020. #define resetterm()             reset_shell_mode()
  2021. #define saveterm()              def_prog_mode()
  2022. #define scrl(n)                 wscrl(stdscr,n)
  2023. #define scroll(w)               wscrl((w),1)
  2024. #define scrollok(w,flag)        ((w)->_scroll  = flag)
  2025. #define setscrreg(top, bot)     wsetscrreg( stdscr, top, bot )
  2026. #define standend()              wattrset(stdscr, A_NORMAL)
  2027. #define standout()              wattrset(stdscr, A_STANDOUT)
  2028. #define timeout(n)              wtimeout( stdscr, n )
  2029. #define touchline(w,y,n)        wtouchln((w),(y),(n),TRUE)
  2030. #define touchwin(w)             wtouchln((w),0,(w)->_maxy,TRUE)
  2031. #if defined (CURSES_LIBRARY)
  2032. # define traceoff()             {trace_on = FALSE;}
  2033. # define traceon()              {trace_on = TRUE;}
  2034. #endif
  2035. #define ungetch(ch)             PDC_ungetch(ch)
  2036. #define untouchwin(w)           wtouchln((w),0,((w)->_maxy),FALSE)
  2037. #define waddch(w, c)            PDC_chadd( w, (chtype)c, (bool)!(SP->raw_out), TRUE )
  2038. #define waddchstr(w, c)         (waddchnstr( w, c, -1 ))
  2039. #define werase(w)               (wmove((w),0,0), wclrtobot(w))
  2040. #define wclear(w)               ((w)->_clear = TRUE , werase(w))
  2041. #define wechochar(w,c)          (waddch(w,(chtype)c)==ERR?ERR:wrefresh(w))
  2042. #define winch(w)                ((w)->_y[(w)->_cury][(w)->_curx])
  2043. #define winchstr(w, c)          (winchnstr( w, c, (w)->_maxx-(w)->_curx ) )
  2044. #define winsstr(w,str)          winsnstr((w),(str),(-1))
  2045. #define winstr(w,str)           winnstr((w),str,(w)->_maxx)
  2046. #define wstandend(w)            wattrset(w, A_NORMAL)
  2047. #define wstandout(w)            wattrset(w, A_STANDOUT)
  2048.  
  2049. #if !defined(UNIX) && !defined(XCURSES)
  2050. # define nocbreak()             (SP->cbreak = FALSE)
  2051. # define cbreak()               (SP->cbreak = TRUE)
  2052. # define nocrmode()             (SP->cbreak = FALSE)
  2053. # define crmode()               (SP->cbreak = TRUE)
  2054. # define noecho()               (SP->echo = FALSE)
  2055. # define echo()                 (SP->echo = TRUE)
  2056. # define nodelay(w,flag)        (w->_nodelay = flag)
  2057. #endif
  2058.  
  2059. #if defined(PDCURSES)
  2060. # define addrawch( c )          waddrawch( stdscr, c )
  2061. # define addrawstr(str)         waddrawstr( stdscr, str )
  2062. # define insrawch( c )          winsrawch( stdscr, c )
  2063. # define waddrawch(w, c)        PDC_chadd( w, (chtype)c, FALSE, TRUE )
  2064. # define winsrawch(w, c)        PDC_chins( w, (chtype)c, FALSE )
  2065. # define PDC_save_key_modifiers(flag) (SP->save_key_modifiers = flag)
  2066. # define PDC_return_key_modifiers(flag) (SP->return_key_modifiers = flag)
  2067.  
  2068. /*
  2069.  *      FYI: Need to document these functions...
  2070.  */
  2071. # define title(s,a)             wtitle( stdscr, s, (chtype)a )
  2072. # define titleofs(ofs)          wtitleofs( stdscr, ofs )
  2073. # define wtitle(w,s,a)          (w->_title = s, w->_title_attr = (chtype)a)
  2074. # define wtitleofs(w,ofs)       (w->_title_ofs = ofs)
  2075. #endif
  2076.  
  2077. /*
  2078.  * return codes from PDC_getclipboard() and PDC_setclipboard() calls.
  2079.  */
  2080. #define PDC_CLIP_SUCCESS        0
  2081. #define PDC_CLIP_ACCESS_ERROR   1
  2082. #define PDC_CLIP_EMPTY          2
  2083. #define PDC_CLIP_MEMORY_ERROR   3
  2084.  
  2085. /*
  2086.  * PDCurses key modifier masks
  2087.  */
  2088. #define PDC_KEY_MODIFIER_SHIFT     (1 << 0)
  2089. #define PDC_KEY_MODIFIER_CONTROL   (1 << 1)
  2090. #define PDC_KEY_MODIFIER_ALT       (1 << 2)
  2091. #define PDC_KEY_MODIFIER_NUMLOCK   (1 << 3)
  2092.  
  2093. /*
  2094.  *      Load up curspriv.h.     This should be in the same place as
  2095.  *      stdlib.h.  We allow anyone who defines CURSES_LIBRARY to have
  2096.  *      access to our internal routines.  This provides quick
  2097.  *      PC applications at the expense of portability.
  2098.  */
  2099. #if defined(CURSES_LIBRARY)
  2100. # include <curspriv.h>
  2101. #endif
  2102.  
  2103. #include <stdlib.h>
  2104.  
  2105. #endif  /* __PDCURSES__ */
  2106.  
  2107. #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS)
  2108. # undef bool
  2109.    }
  2110. #endif
  2111.